473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Looping through a formview web control .. childtable?

I have a many many pages with many formviews with many textboxes in
them. The matrix of types of validation I need to do is a giant mess so
please don't judge the code you are about to see - I don't want to use
the new and native validatongroups .. well at least I want to know what
I'm trying is not possible.

I'm trying to loop through the controls of formview and I think I'm
close, but Im missing something.
the below for loop erroneously only has one count.. which is ofcourse
not what I expected with over 50 textboxes in the formview while in
insert mode. I've tried to code the function expecting type formview
but that did not work either.

In my test I pass routeformview to the function Validdata

in debug

what = ctl00_ContentPlaceHolder1_RouteFormView_ctl00
what2 = System.Web.UI.WebControls.ChildTable
what3 = has a value
what4 = is empty as expected.
Am I missing something???
Thanks.

....
====
Function ValidData(ByVal whichformview As Control) As Boolean
Dim returnvalue As Boolean = True
Dim what,what2 As String
For Each c As Control In whichformview.Controls
what = c.ClientID
what2 = c.GetType().ToString
what3 = CType(RouteFormView.FindControl("iRouteDescr"), TextBox).Text
what4 = CType(RouteFormView.FindControl("iRouteCode_req"),
TextBox).Text
If c.GetType().ToString = "System.Web.UI.WebControls.TextBox" Then
If c.ClientID.Contains("_date") Then
End If
If c.ClientID.Contains("_num") Then
End If
If c.ClientID.Contains("_req") Then
If CType(c, TextBox).Text = Nothing Then
StatusLabel.Text = +c.ID + "is Required" + vbCrLf
c.Focus()
returnvalue = False
End If
End If

End If

Next
Return returnvalue
====

Nov 10 '06 #1
0 1284

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TdarTdar | last post by:
I wanted to add three columns up on the form and run some logic to fill in the third but not sure how to call the field names in the formview control. Dim Girth As Integer Elenght =...
2
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry...
2
by: P. Yanzick | last post by:
Hello, I am creating an edit template for a FormView control, changing one of the textboxes to a dropdown box. The dropdown will be populated from a simple table with the primary key, and a...
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
4
by: J055 | last post by:
Hi I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both buttons to update the data source but the 'OK' button should redirect afterwards. I can see which button is clicked...
2
by: Phil Sandler | last post by:
I am trying to do something which seems (to me) to be very simple, and yet I can't seem to figure it out. I have a gridview and a formview. When a user clicks "select" in the gridview, the...
6
by: jobs | last post by:
This code was working, but then stopped working. I don't think I completely understand it. I pass it a formview name and it would loop through checking the value of textboxes. problem is...
0
by: =?Utf-8?B?SHVnaA==?= | last post by:
New to formview control. Wondering the best way to loop through certain type of objects (such as textbox) in a formview. Thank
3
by: J055 | last post by:
Hi I can't figure out what the difference is here. Sometimes I have a simple FormView control in a page and I can use the FormView.FindControl method to get a Label or TextBox with in it during...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.