Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

Looop through the controls...

 

Private

 

SetTooltip(oControl, strToolTip)

FindToolTipControl(oControl.Controls, strToolTip)

 

Sub FindToolTipControl(ByVal oControlCollection As ControlCollection, ByVal strToolTip As String)For Each oControl As Control In oControlCollectionNext

 

......................

 

 

 

Private Sub SetTooltip(ByVal oControl As Control, ByVal strToolTip As String)Select Case oControl.GetType.ToStringCase "System.Web.UI.WebControls.TextBox"

 

Response.Write(

 

Dim otxt As TextBox = oControl.FindControl(oControl.ID)"<br>" & "TextBox:- " & otxt.Text.ToString())Case "System.Web.UI.WebControls.DropDownList"

 

Response.Write(

 

Dim oDdl As DropDownList = oControl.FindControl(oControl.ID)"<br>" & "DropDown :- " & oDdl.Text.ToString())Case "System.Web.UI.WebControls.RadioButton"

 

Response.Write(

 

Dim oRdbtn As RadioButton = oControl.FindControl(oControl.ID)"<br>" & "RadioButton:- " & oRdbtn.Text.ToString())Case "System.Web.UI.WebControls.CheckBox"

 

 

Dim oChkbx As CheckBoxList = oControl.FindControl(oControl.ID)'Response.Write("<br>" & "Ckeckboxloist" & oChkList.Items.Count.ToString())

 

 

Response.Write(

 

Dim MyItem As ListItemFor Each MyItem In oChkbx.Items"<br>" & "Ckeckbox:- " & MyItem.Text.ToString())Next

 

Case "System.Web.UI.WebControls.Label"

 

Response.Write(

 

Dim oLabel As Label = oControl.FindControl(oControl.ID)"<br>" & "Label:- " & oLabel.Text)Case "System.Web.UI.WebControls.CheckBoxList"

 

 

Dim oChkList As CheckBoxList = oControl.FindControl(oControl.ID)'Response.Write("<br>" & "Ckeckboxloist" & oChkList.Items.Count.ToString())

 

 

Response.Write(

 

Dim MyItem As ListItemFor Each MyItem In oChkList.Items"<br>" & "Ckeckboxlist:- " & MyItem.Text.ToString())Next

 

Case "System.Web.UI.HtmlControls.HtmlTableRow"

 

 

Dim oTbrw As HtmlTableRow = oControl.FindControl(oControl.ID)'Response.Write("<br>" & "Table row:- " & oTbrw.InnerText.ToString())

 

End Select

 

End Sub

End Sub Posted on Monday, August 4, 2008 5:23 AM .Net | Back to top


Comments on this post: Iterating through controls in form + vb.net

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net