I am trying to create a function to test if a textbox is null. I am trying to accomplish this because I have a lot to my code and I figured this would be a great way to clean up my code making it easier to read.
Main Code Page
Private Sub Command0_Click()
Dim textbox1 As String
textbox1 = Forms![Form1].Text1
MsgBox CheckTextbox(textbox1)
End Sub
Function
Public Function CheckTextbox(textboxA As String)
If IsNull(textboxA) Then
CheckTextbox = "Yes"
Else
CheckTextbox = textboxA
End If
End Function
A String can not be Null, thus:
Private Sub Command0_Click()
Dim textbox1 As Variant
textbox1 = Forms![Form1].Text1.Value
MsgBox CheckTextbox(textbox1)
End Sub
and:
Public Function CheckTextbox(textboxA As Variant)
If IsNull(textboxA) Then
CheckTextbox = "Yes"
Else
CheckTextbox = textboxA
End If
' or simply:
CheckTextbox = Nz(textboxA, "Yes")
End Function
Related
How can I add a CheckBox in the Header? It will then select all the CheckBoxes.
Also, how can I align the CheckBox in center.
Here's my Code:
Private Sub frm_reciev_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim chkbox As New DataGridViewCheckBoxColumn
With chkbox
.Width = 60
End With
With DataGridView1
.Columns.Add(chkbox)
.RowHeadersVisible = False
End With
End Sub
Heres the image:
If i remember well :
dataGridView1.Columns[ColumnName].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
To create a customised header cell (one containing the CheckBox, and supporting functionality) you will need to create three classes.
DataGridViewCheckBoxHeaderCell.vb
Imports System.Windows.Forms.VisualStyles
Public Class DataGridViewCheckBoxHeaderCell
Inherits DataGridViewColumnHeaderCell
Public Event CheckBoxClicked As EventHandler(Of DataGridViewCheckBoxHeaderCellEventArgs)
Private Property CheckBoxLocation As Point
Private Property CheckBoxSize As Size
Private Property IsChecked As Boolean
Private Property CellLocation As Point
Private Property CheckBoxState As CheckBoxState
Protected Overrides Sub Paint(graphics As Graphics,
clipBounds As Rectangle,
cellBounds As Rectangle,
rowIndex As Integer,
dataGridViewElementState As DataGridViewElementStates,
value As Object,
formattedValue As Object,
errorText As String,
cellStyle As DataGridViewCellStyle,
advancedBorderStyle As DataGridViewAdvancedBorderStyle,
paintParts As DataGridViewPaintParts)
MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts)
CheckBoxSize = CheckBoxRenderer.GetGlyphSize(graphics, CheckBoxState.UncheckedNormal)
Dim x As Integer = cellBounds.Location.X + (cellBounds.Width / 2) - (CheckBoxSize.Width / 2)
Dim y As Integer = cellBounds.Location.Y + (cellBounds.Height / 2) - (CheckBoxSize.Height / 2)
CheckBoxLocation = New Point(x, y)
CellLocation = cellBounds.Location
CheckBoxState = If(IsChecked, CheckBoxState.CheckedNormal, CheckBoxState.UncheckedNormal)
CheckBoxRenderer.DrawCheckBox(graphics, CheckBoxLocation, CheckBoxState)
End Sub
Protected Overrides Sub OnMouseClick(e As DataGridViewCellMouseEventArgs)
Dim p As Point = New Point(e.X + CellLocation.X, e.Y + CellLocation.Y)
If (p.X >= CheckBoxLocation.X AndAlso
p.X <= CheckBoxLocation.X + CheckBoxSize.Width AndAlso
p.Y >= CheckBoxLocation.Y AndAlso
p.Y <= CheckBoxLocation.Y + CheckBoxSize.Height) Then
IsChecked = Not IsChecked
Dim eventArgs As New DataGridViewCheckBoxHeaderCellEventArgs(e.ColumnIndex, IsChecked)
OnCheckBoxClicked(eventArgs)
Me.DataGridView.InvalidateCell(e.ColumnIndex, e.RowIndex)
End If
MyBase.OnMouseClick(e)
End Sub
Protected Overridable Sub OnCheckBoxClicked(eventArgs As DataGridViewCheckBoxHeaderCellEventArgs)
RaiseEvent CheckBoxClicked(Me, eventArgs)
End Sub
End Class
DataGridViewCheckBoxEventArgs.vb
Public Class DataGridViewCheckBoxHeaderCellEventArgs
Inherits EventArgs
Public Sub New(columnIndex As Integer, isChecked As Boolean)
Me.ColumnIndex = columnIndex
Me.IsChecked = isChecked
End Sub
Public Property ColumnIndex As Integer
Public Property IsChecked As Boolean
End Class
DataGridViewCustomCheckBoxColumn.vb
Public Class DataGridViewCustomCheckBoxColumn
Inherits DataGridViewCheckBoxColumn
Public Sub New()
MyBase.New()
MyBase.CellTemplate = New DataGridViewCheckBoxCell()
Dim datagridViewCheckBoxHeaderCell As New DataGridViewCheckBoxHeaderCell()
Me.HeaderCell = datagridViewCheckBoxHeaderCell
Me.Width = 50
AddHandler datagridViewCheckBoxHeaderCell.CheckBoxClicked, AddressOf datagridViewCheckBoxHeaderCell_OnCheckBoxClicked
End Sub
Private Sub datagridViewCheckBoxHeaderCell_OnCheckBoxClicked(sender As Object, e As DataGridViewCheckBoxHeaderCellEventArgs)
DataGridView.RefreshEdit()
For Each row As DataGridViewRow In Me.DataGridView.Rows
If (Not row.Cells(e.ColumnIndex).ReadOnly) Then
row.Cells(e.ColumnIndex).Value = e.IsChecked
End If
Next
DataGridView.RefreshEdit()
End Sub
Public Overrides Property CellTemplate As DataGridViewCell
Get
Return MyBase.CellTemplate
End Get
Set
' Ensure that the cell used for the template is a DataGridViewCheckBoxCell.
If (Value IsNot Nothing) Then
Throw New InvalidCastException("Must be a DataGridViewCheckBoxCell")
End If
MyBase.CellTemplate = Value
End Set
End Property
End Class
and finally a demo/testing form to illustrate how it all works together. After dropping a DataGridView on to your form, use this code to quickly fill it with test data comprised of four columns.
Public Class Form1
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
InitialiseData()
DataGridView1.AutoGenerateColumns = False
DataGridView1.Columns.Clear()
' This is the important line that will add a customised Checkbox colum to the DataGridView
Dim checkedColumn As New DataGridViewCustomCheckBoxColumn()
checkedColumn.DataPropertyName = "Checked"
DataGridView1.Columns.Add(checkedColumn)
Dim nameColumn As New DataGridViewTextBoxColumn()
nameColumn.DataPropertyName = "Name"
DataGridView1.Columns.Add(nameColumn)
Dim addressColumn As New DataGridViewTextBoxColumn()
addressColumn.DataPropertyName = "Address"
DataGridView1.Columns.Add(addressColumn)
Dim phoneColumn As New DataGridViewTextBoxColumn()
phoneColumn.DataPropertyName = "Phone"
DataGridView1.Columns.Add(phoneColumn)
DataGridView1.DataSource = People
End Sub
Private People As DataTable
Private Sub InitialiseData()
People = New DataTable()
People.Columns.Add("Checked", GetType(Boolean))
People.Columns.Add("Name", GetType(String))
People.Columns.Add("Address", GetType(String))
People.Columns.Add("Phone", GetType(String))
People.Rows.Add(True, "J1", "Address1", "123")
People.Rows.Add(False, "J2", Nothing, "456")
People.Rows.Add(True, "J3", "Address3", "789")
People.Rows.Add(False, "J4", "Address4", "147")
People.Rows.Add(DBNull.Value, "J5", "Address5", "258")
End Sub
End Class
I've created an HTML template with placeholders, like #Name#, #Address#, #City#, etc.
How can I access the file and replace the placeholders with TextBox values from the form? Then, once the replacements have been made, how can I save the file with a new name.
I'm trying StreamReader and StreamWriter at the moment, but not having much success. Here's what I have so far. Im getting this exception upon button click:
System.InvalidCastException: 'Conversion from string "C:\test.html" to type 'Integer' is not valid.'
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ReadTextFile()
Dim TempText As String
Dim TextPath = "C:\test.html"
TempText = ReadTextFile(TextPath)
TempText = TempText.Replace("#Name#", TextBox1.Text)
WebBrowser1.Navigate("C:\test.html")
End Sub
Public Function ReadTextFile()
Dim TempString As String
Dim TextFileName As String = "C:\test.html"
Dim StreamToDisplay As System.IO.StreamReader
StreamToDisplay = New System.IO.StreamReader(TextFileName)
TempString = StreamToDisplay.ReadToEnd
StreamToDisplay.Close()
Return TempString
End Function
End Class
If I click on yes, VBA keeps going to the function Mandate? What did I do wrong?
Public AutoDate As Date
Public NewDate As String
Public Sub GetDate() ' DATUM BEPALEN
AutoDate = Date - 1
MsgBox (AutoDate), (vbYesNo), ("Datum")
Dim Response As VbMsgBoxResult
If Response = vbYes Then
NewDate = AutoDate
Call DeleteDate
Else ' No
Call ManDate
End If
End Sub
You haven't assigned the result of MsgBox to Response.
Not sure if VbMsgBoxResult is a valid data type in that instance either.
Try either of these:
Public Sub GetDate() ' DATUM BEPALEN
AutoDate = Date - 1
If MsgBox(AutoDate, vbYesNo, "Data") = vbYes Then
NewDate = AutoDate
Call DeleteDate
Else ' No
Call ManDate
End If
End Sub
or
Public Sub GetDate() ' DATUM BEPALEN
Dim Response As Long
AutoDate = Date - 1
Response = MsgBox(AutoDate, vbYesNo, "Data")
If Response = vbYes Then
NewDate = AutoDate
Call DeleteDate
Else ' No
Call ManDate
End If
End Sub
You need retrieve the Response as the return of the MsgBox function:
Dim Response as Integer
Response= MsgBox( AutoDate, vbYesNo, "Datum")
Now you can if-test Response to decide what to do.
You need a variable to capture the response ...
Dim ans As Integer
ans = MsgBox("hello", vbYesNo, "Datum")
If ans = vbYes Then
MsgBox "Yes"
Else
MsgBox "No"
End If
I want to create a table for LEDs. This table creates information such as name, center wavelength and the spectrum, which itself is data in the format intensity over wavelenth as 2 x n table data.
I am a beginner in access and have currently no clue how to insert this to a table.
I could of course create for each LED a table on its own, but there will be hundreds of these spectrum datas.
Such a complex data structure may be difficult to implement in a database table. An option I propose is to have a set of classes that represent the data. Then you can serialize and deserialize (read and write) the data to a file.
Sample Implementation
Module Module1
Sub Main()
Dim leds = New List(Of LED)()
Dim rnd = New Random()
'create a bunch of LEDs
For i = 1 To 10
Dim led = New LED("LED " & (i + 1).ToString(), rnd.Next(0, i * 100))
For x = 1 To 10
led.Spectrum.Add(New SpectrumInfo(rnd.Next(1, 10), rnd.Next(1000, 10000)))
Next
leds.Add(led)
Next
' write the led data to a file
Using sw As New IO.StreamWriter("LED Data.ledx")
Dim xs = New System.Xml.Serialization.XmlSerializer(leds.GetType())
xs.Serialize(sw, leds)
End Using
'read the led data from a file
Dim leds2 = New List(Of LED)()
Using sr = New System.IO.StreamReader("LED Data.ledx")
Dim xs = New System.Xml.Serialization.XmlSerializer(leds2.GetType())
leds2 = DirectCast(xs.Deserialize(sr), List(Of LED))
End Using
'confirm the two are the same
Console.WriteLine("LEDs and LEDS2 are " & If(leds.SequenceEqual(leds2), "the same", "different"))
' alternate saving using binary serializer
' works in cases where XmlSerializer doesn't
' produces smaller files too
'save the led data
Using fs = New System.IO.FileStream("LED Data.ledb", IO.FileMode.Create)
Dim bf = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
bf.Serialize(fs, leds)
End Using
'read the led data
Dim leds3 = New List(Of LED)()
Using fs = New System.IO.FileStream("LED Data.ledb", IO.FileMode.Open)
Dim bf = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
leds3 = DirectCast(bf.Deserialize(fs), List(Of LED))
End Using
'confirm equality
Console.WriteLine("LEDs and LEDS3 are " & If(leds.SequenceEqual(leds3), "the same", "different"))
Console.WriteLine("LEDs2 and LEDS3 are " & If(leds2.SequenceEqual(leds3), "the same", "different"))
Console.ReadLine()
End Sub
End Module
<Serializable()> _
Public Class LED
Dim _name As String
Dim _cWL As Double
Dim _spectrum As List(Of SpectrumInfo)
Public Sub New()
_name = String.Empty
_cWL = 0
_spectrum = New List(Of SpectrumInfo)()
End Sub
Public Sub New(name As String, cwl As Double, ParamArray spectrum() As SpectrumInfo)
_name = name
_cWL = cwl
_spectrum = New List(Of SpectrumInfo)(spectrum)
End Sub
Public Property Name As String
Get
Return _name
End Get
Set(value As String)
_name = value
End Set
End Property
Public Property CenterWavelength As Double
Get
Return _cWL
End Get
Set(value As Double)
_cWL = value
End Set
End Property
Public ReadOnly Property Spectrum As List(Of SpectrumInfo)
Get
Return _spectrum
End Get
End Property
Public Overrides Function Equals(obj As Object) As Boolean
If Not (TypeOf obj Is LED) Then Return False
Dim l2 = DirectCast(obj, LED)
Return l2._name = _name AndAlso l2._cWL = _cWL AndAlso l2._spectrum.SequenceEqual(_spectrum)
End Function
Public Overrides Function ToString() As String
Return String.Format("{0} [{1}]", _name, _cWL)
End Function
Public Overrides Function GetHashCode() As Integer
Dim result As Integer
For Each spec In _spectrum
result = result Xor spec.GetHashCode()
Next
Return result Xor (_name.GetHashCode() + _cWL.GetHashCode())
End Function
End Class
<Serializable()> _
Public Structure SpectrumInfo
Dim _intensity As Double
Dim _wavelength As Double
Public Sub New(intensity As Double, wavelength As Double)
_intensity = intensity
_wavelength = wavelength
End Sub
Public ReadOnly Property Intensity As Double
Get
Return _intensity
End Get
End Property
Public ReadOnly Property Wavelength As Double
Get
Return _wavelength
End Get
End Property
Public Overrides Function Equals(obj As Object) As Boolean
If TypeOf obj Is SpectrumInfo Then
Dim si = DirectCast(obj, SpectrumInfo)
Return si._wavelength = _wavelength AndAlso si._intensity = _intensity
Else
Return False
End If
End Function
Public Overrides Function ToString() As String
Return String.Format("Intensity: {0}, Wavelength: {1}", _intensity, _wavelength)
End Function
Public Overrides Function GetHashCode() As Integer
Return _intensity.GetHashCode() Xor _wavelength.GetHashCode()
End Function
End Structure
You might look at http://r937.com/relational.html
I think you want:
LED Table
ID
LEDName
CenterWavelength
And then a table for spectra
ID
LedId
Intensisty
WaveLength
Here is the Code:
VB:
Imports System.Web.Script.Serialization
Partial Class MyLanding
Inherits System.Web.UI.Page
Private LoginClass As New LoginClass
Private _dockStateCleared As Boolean = False
Private _conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MidwestPartsConnectionString").ConnectionString)
Private ReadOnly Property CurrentDockStates() As List(Of DockState)
Get
'Get saved state string from the database - set it to dockState variable for example
Dim dockStatesFromDB As String = ""
_conn.Open()
Dim command As New SqlCommand("SELECT JavascriptStr FROM SysProperties WHERE (UserID = #UserID)", _conn)
command.Parameters.Add("#UserID", SqlDbType.UniqueIdentifier).Value = Me.LoginClass.ReturnUserID()
Try
dockStatesFromDB = command.ExecuteScalar().ToString()
_conn.Close()
Catch ex As Exception
_conn.Close()
Me.CreateSavedLayout("")
End Try
Dim _currentDockStates As New List(Of DockState)()
Dim stringStates As String() = dockStatesFromDB.Split("|"c)
For Each stringState As String In stringStates
If stringState.Trim() <> String.Empty Then
_currentDockStates.Add(DockState.Deserialize(stringState))
End If
Next
Return _currentDockStates
End Get
End Property
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
If Not Page.IsPostBack Then
If CurrentDockStates.Count = 0 Then
Me.LoadItems()
End If
End If
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
Dim i As Integer = 0
While i < CurrentDockStates.Count
If CurrentDockStates(i).Closed = False Then
Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i))
dlColumnOne.Controls.Add(dock)
CreateSaveStateTrigger(dock)
LoadUserControl(dock)
End If
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
End While
End Sub
Protected Sub dlColumnOne_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs)
For Each state As DockState In CurrentDockStates
e.Positions(state.UniqueName) = state.DockZoneID
e.Indices(state.UniqueName) = state.Index
Next
End Sub
Protected Sub dlColumnOne_SaveDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs)
Dim stateList As List(Of DockState) = dlColumnOne.GetRegisteredDocksState()
Dim serializedList As New StringBuilder()
Dim i As Integer = 0
While i < stateList.Count
serializedList.Append(stateList(i).ToString())
serializedList.Append("|")
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
End While
Dim dockState As String = serializedList.ToString()
If dockState.Trim() <> [String].Empty Then
_conn.Open()
Dim command As New SqlCommand([String].Format("update sysproperties set javascriptstr = '{0}' Where UserID = #UserID ", dockState), _conn)
command.Parameters.Add("#UserID", SqlDbType.UniqueIdentifier).Value = Me.LoginClass.ReturnUserID()
command.ExecuteNonQuery()
_conn.Close()
End If
End Sub
Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock
Dim dock As New RadDock()
dock.DockMode = DockMode.Docked
dock.UniqueName = state.UniqueName
dock.ID = String.Format("RadDock{0}", dock.UniqueName)
dock.ApplyState(state)
dock.Commands.Add(New DockCloseCommand())
dock.Commands.Add(New DockExpandCollapseCommand())
Return dock
End Function
Private Function CreateRadDock(ByVal DockTitle As String) As RadDock
Dim docksCount As Integer = CurrentDockStates.Count
Dim dock As New RadDock
dock.DockMode = DockMode.Docked
Dim UniqueName As String = Guid.NewGuid().ToString()
UniqueName = UniqueName.Replace("-", "")
dock.UniqueName = UniqueName
dock.ID = String.Format("RadDock{0}", UniqueName)
dock.Title = DockTitle
dock.Width = Unit.Pixel(400)
dock.Commands.Add(New DockCloseCommand())
dock.Commands.Add(New DockExpandCollapseCommand())
Return dock
End Function
Private Sub LoadItems()
Dim DocksDataTable As DataTable = Me.ReturnReports()
For i = 0 To DocksDataTable.Rows.Count() - 1
Dim dock As RadDock = Me.CreateRadDock(DocksDataTable.Rows(i).Item("ReportTitle").ToString())
Dim dz As RadDockZone = Me.dzColumnOne
Dim dl As RadDockLayout = Me.dlColumnOne
dz.Controls.Add(dock)
Me.CreateSaveStateTrigger(dock)
dock.Tag = DocksDataTable.Rows(i).Item("ReportPath")
Me.LoadUserControl(dock)
Next
End Sub
Public Function ReturnReports() As DataTable
Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("MidwestPartsConnectionString").ConnectionString)
Dim Query As String = "SELECT Reports.ReportPath, Reports.ReportTitle, UserReports.UserID FROM UserReports INNER JOIN Reports ON UserReports.ReportID = Reports.ReportID WHERE (UserReports.UserID = #UserID)"
Dim adapter As New SqlDataAdapter
adapter.SelectCommand = New SqlCommand(Query, connection)
adapter.SelectCommand.Parameters.Add("#UserID", SqlDbType.UniqueIdentifier).Value = Me.LoginClass.ReturnUserID()
Dim table1 As New DataTable
connection.Open()
Try
adapter.Fill(table1)
Finally
connection.Close()
End Try
Return table1
End Function
Private Function ReturnLayout() As DataTable
Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("MidwestPartsConnectionString").ConnectionString)
Dim Query As String = "select * from sysproperties"
Dim adapter As New SqlDataAdapter
adapter.SelectCommand = New SqlCommand(Query, connection)
adapter.SelectCommand.Parameters.Add("#UserPropertiesID", SqlDbType.Int).Value = 1
Dim table1 As New DataTable
connection.Open()
Try
adapter.Fill(table1)
Finally
connection.Close()
End Try
Return table1
End Function
Private Sub LoadUserControl(ByVal dock As RadDock)
If String.IsNullOrEmpty(dock.Tag) Then
Return
End If
Dim usercontrol As Control = LoadControl(dock.Tag)
dock.ContentContainer.Controls.Add(usercontrol)
End Sub
Private Sub CreateSaveStateTrigger(ByVal dock As RadDock)
dock.AutoPostBack = True
dock.CommandsAutoPostBack = True
Dim saveStateTrigger As New AsyncPostBackTrigger()
saveStateTrigger.ControlID = dock.ID
saveStateTrigger.EventName = "DockPositionChanged"
UpdatePanel1.Triggers.Add(saveStateTrigger)
saveStateTrigger = New AsyncPostBackTrigger()
saveStateTrigger.ControlID = dock.ID
saveStateTrigger.EventName = "Command"
UpdatePanel1.Triggers.Add(saveStateTrigger)
End Sub
Private Sub CreateSavedLayout(ByVal JavascriptStr As String)
Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("MidwestPartsConnectionString").ConnectionString)
Dim strSqlInsert As String = "INSERT INTO SysProperties(UserID, JavascriptStr) VALUES (#UserID, #JavascriptStr)"
strSqlInsert += "; SELECT SCOPE_IDENTITY() ;"
Dim sqlCmd As New SqlCommand(strSqlInsert, sqlConn)
With sqlCmd.Parameters
.Add("#JavascriptStr", SqlDbType.Text).Value = JavascriptStr
.Add("#UserID", SqlDbType.UniqueIdentifier).Value = Me.LoginClass.ReturnUserID()
End With
sqlCmd.Connection.Open()
sqlCmd.ExecuteScalar()
sqlCmd.Connection.Close()
End Sub
Protected Sub btnAddReports_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddReports.Click
Try
Response.Redirect("~/MyUserAccount/SelectedReports.aspx", False)
Catch ex As Exception
End Try
End Sub
End Class
Your could looks fine. Possible reasons for this problem include the following:
Dragging the Dock control very quickly causes an ajax conflict, and an error is shown. To avoid this from happening you could show an AjaxLoading panel during the process of an ajax request (search/ask in the telerik forums for a sample showing how to do this). Additionally you should make sure the UpdatePanels on your site are configured as in the following online demo: http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx.
The error is a result of a ViewState problem. This telerik forum thread provides a possible solution: www.telerik.com/community/forums/aspnet-ajax/docking/failed-to-load-view-state-error-when-moving-dynamically-created-widgets-around-the-raddocklayout.aspx