Hi All
I am getting below error. basically I want to loop through all controls in a page and make sure they have not changed the values. if they have i want to prompt a message asking to save.
while looping the controls I am not able to send it as a string its erroring out. can some one please suggest how to convert String to a webcontrol
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.WebControl'.
Source Error:
Line 19: For Each ctrl As Control In Page.Controls
Line 20: 'w = CType(ctrl, WebControl)
Line 21: MonitorChanges(ctrl.ID)
Line 22: Next
Line 23: End Sub
Public Sub MonitorChanges(ByVal wc As WebControl)
If wc Is Nothing Then Exit Sub
If TypeOf wc Is CheckBoxList OrElse TypeOf wc Is RadioButtonList Then
'Add an array element for each item in the checkbox/radiobutton list
For i As Integer = 0 To CType(wc, ListControl).Items.Count - 1
Page.RegisterArrayDeclaration("monitorChangesIDs", """" & String.Concat(wc.ClientID, "_", i) & """")
Page.RegisterArrayDeclaration("monitorChangesValues", "null")
Next
Else
Page.RegisterArrayDeclaration("monitorChangesIDs", """" & wc.ClientID & """")
Page.RegisterArrayDeclaration("monitorChangesValues", "null")
End If
'AssignMonitorChangeValuesOnPageLoad()
End Sub