|
-
Jan 20th, 2004, 11:52 AM
#1
Thread Starter
Evil Genius
Evaluate Datalist Controls
I've got this code to go through all textboxes on a webform & look to see if each of them have a blank value. How can I use something like this to go through all item textbox controls created in/by a datalist please???
VB Code:
For each ctlWebFormControl in page.Controls
If (ctlWebFormControl.GetType.ToString.
Equals("System.Web.UI.WebControls.TextBox")) then
If not(CType(ctlWebFormControl, _
System.Web.UI.WebControls.TextBox).Text = "")) then_
' Something Here
End if
End If
Next
Thanks!!
-
Jan 22nd, 2004, 07:56 PM
#2
Lively Member
Internal part of the loop is fine, external should look something like:
Code:
foreach(DataListItem dli in MyDataList.Items)
{
foreach(Control ctl in dli.Controls)
{
//here is your logic
}
}
-
Jan 23rd, 2004, 03:41 AM
#3
Thread Starter
Evil Genius
Ah thanks for that, forgot I had this one posted here. Incase anyone else tries to do this in future I used this code:
VB Code:
For intLoopCounter = 1 to (DatalistName.Items.count)
If not(CType(DatalistName.Items(intLoopCounter).Controls(1), _
System.Web.UI.WebControls.TextBox).Text = "") then
' Some Code here...
End If
Next intLoopCounter
Many thanks for the reply though Split, much appriciated!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|