'Find' is not a member of 'System.Web.UI.ControlCollection'.

I have 5 rows (2 textboxes and 1 dropdownlist on each row)...named like txtDate1/txtHours1/ddlType1 (row 1), txtDate2/txtHours2/ddlType2 (row 2)...and so on. On each row, if the user has put data in one of the textboxes, then the other one need to have data as well.  If they both have info...fine, if they both don't have info...fine.  Anyway, I'm trying to streamline my saving procedure with a loop, but I'm having problems.

Here's my code

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Dim i As Integer
        Dim err As Integer

        For i = 1 To 5
            Dim dt As TextBox = DirectCast(Me.Controls.Find("txtDate" & i.ToString(), True)(0), TextBox)
            Dim ht As TextBox = DirectCast(Me.Controls.Find("txtHours" & i.ToString(), True)(0), TextBox)
            If dt.Text <> "" And ht.Text = "" Or dt.Text = "" And ht.Text <> "" Then
                err = 1
            End If

    End Sub



3/12/2008 3:26:52 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 27

Try Me.Controls.FindControl

If everything happens for a reason what is the reason for this error?
3/12/2008 4:00:40 PM

I figured it out...something I didn't mention was that I am using a MasterPage so my solution is:

Me.Master.FindControl("ContentPlaceHolder1").FindControl("txtDate" & i.ToString())

3/12/2008 5:07:50 PM

Similar Artilces:

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'DataItem' is not a member of 'System.Web.UI.Page'
I am getting this error when compiling the following code: <%@ Import Namespace="System.IO"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Data"%><script language="VB" runat="server"> Dim savePath As String = "C:\upload\"Sub Upload_Click(source As Object, e As EventArgs)   If Not (uploadedFile.PostedFile Is Nothing) Then    Try      Dim postedFile = uploadedFile.PostedFile      Dim filename As String = Path.GetFi...

'DataItem' is not a member of 'System.Web.UI.Control'
I was going through the "WEb Matrix Guided Tour" and ran across the following error when I tried to do the section "ASP.NET Pages with Data (SQL Server/MSDE) DataList and Templates". I went through it three times and can not get past this point. Any suggestions would be appreciated. PS: Rookie to this, so please be kind!!! Server Error in '/' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during the compilation of a resource required to service this requ...

'DisplayDataFromPage' is not a member of 'System.Web.UI.MasterPage'.
 I try to use DisplayDataFromPage method in content page and display value in the masterpage via MasterPage's method called DisplayDataFromPage (the same), but still it says:  'DisplayDataFromPage' is not a member of 'System.Web.UI.MasterPage'. Masterpage3.master.vb  Inherits System.Web.UI.MasterPagePublic Sub DisplayDataFromPage(ByVal strodbalance As Double) lblodbalance.Text = strodbalance End SubPublic ReadOnly Property DataFromPageLabelControl() As Label GetReturn Me.lblodbalance End Get End Property cashstatement.vb Inherits Syste...

'DataItem' is not a member of 'System.Web.UI.Control'
Hi I am getting this error on my attempt at a repeater control. Any help would be appreciated. This is the code for the HTML <asp:Repeater id="rptTests" runat="server"></asp:Repeater> <ITEMTEMPLATE> <tr style="BACKGROUND-COLOR: #ffecd8"> <td> <%# DataBinder.Eval(Container.DataItem, "test") %> </td> </tr> </ITEMTEMPLATE> This is the cod...

'Cells' is not a member of 'System.Web.UI.WebControls.GridViewRowCollection'
I have a vb.net page that allows users to upload multiple files, and also stores data about the files in my sql database (FileID, FileName, etc).   I then display a gridview with the names of the file, and a delete link button, so if the user uploads the wrong file, I want to let them delete the file, but I keep getting this error when trying to delete.   If I hard code in a file name, the delete works fine, I just can't seem to grab the FileName from the gridview and delete a file from the directory when FileName matches the name of the uploaded document.&n...

BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
 I am getting compilation error (bold line): BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'. I am using ASP.NET 2.0 - w/AJAX 2.0 Extension. <asp:UpdatePanel UpdateMode="Always" runat="server">             <ContentTemplate>                   <asp:LinkButton ID="rateit" runat="server" CssClass="vote" Height="56px" Width="63px&...

Error: 'DataBinder' is not a member of 'System.Web.UI.DataBinder'.
I'm getting the following error trying to compile.  'DataBinder' is not a member of 'System.Web.UI.DataBinder'. It points this line of code <%# DataBinder.Eval(Container, "DataItem.STORE_NO")%>   I'm creating a VB module for DotNetNuke if this might help.   Thanks,  Erick   What happens when you remove DataBinder.?Community Coder Also, what type of control are you trying to bind data to?  Community Coder jamesqua: What happens when you remove DataBinder.? Now I get this error:Error 69 Value...

'Items' is not a member of 'System.Web.UI.WebControls.GridView'
I'm attempting to run the below script to get the ID value of check boxes in my datagrid (dgBook).    Protected Sub btnTransfer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTransfer.Click Dim i As Integer Dim blnIsChecked As Boolean For i = 0 To dgBook.Items.Count - 1 blnIsChecked = DirectCast(dgBook.Items(i).Cells(4).FindControl("BookID"), Web.UI.WebControls.CheckBox).Checked If blnIsChecked = True Then Response.Write(i & " IS Checked <BR>") Response.Wr...

'Text' is not a member of 'System.Web.UI.WebControls.DropDownList'
Ive got a problem here.I had a script that took user registration info from a form and added it to a database. I had a few issues with relpacing characters and someone gave my some advice on simplifing my script.  Now i am having loads of problems with it.First of all it is now throwing the error above'Text' is not a member of 'System.Web.UI.WebControls.DropDownList'Basically i have a dropdown box with counties in it, oh god this asp.net is killing meSorry code dump:<%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %>  <script language="...

'CurrentPageIndex' is not a member of 'System.Web.UI.WebControls.GridView'.
I have this line of code which has a syntax error. Tried to search google for solution by typing the error mesg but no avail.GVCRlisting.CurrentPageIndex = 0 This is the error mesg I got when I rollover my mouse to the above line of code: 'CurrentPageIndex' is not a member of 'System.Web.UI.WebControls.GridView'.  Anyone know how to fix this? Thanks. My HomePage - www.findingsteve.net"It is more blessed to give than to receive." Acts 20: 35 (NIV, Bible)Progress - "Never discourage anyone...who continually makes progress, no matter how slow.&...

'Data' is not a member of 'System.Web.UI.WebControls.DataGridItem'
I receive this error and cannot seem to fix it.  this is asp.net built in VB2005.  <%# CheckPDF(Container.DataItem("PDFLocation"), Container.DataItem("F0")) %> is my Funciton call to CheckPDF Public Function CheckPDF(ByVal sLoc As Object, ByVal sID As String) As String If dbNulltoStr(sLoc).Length > 0 Then Return "<a href='ShowScan.aspx?id=" & sID & "'><img src=""images\pdf.gif"" id=""btn2"" border=""0""></a>" End If Return &quo...

'SetDataBinding' is not a member of 'System.Web.UI.WebControls.DataGrid'
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclasstopic.aspI have copied above code and executed it on my personal webserver (Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 ).  It returned with following error.Compiler Error Message: BC30456: 'SetDataBinding' is not a member of 'System.Web.UI.WebControls.DataGrid'. change it "SetDataBinding" to Datasource and see what happensMy Regards to All,Jason -- O-H-I-O Go Buckeyes! #1--- LIVESTRONG.ORG --- Please support the battle against cancer! Also when yo...

Web resources about - 'Find' is not a member of 'System.Web.UI.ControlCollection'. - asp.net.getting-started

Resources last updated: 12/8/2015 5:55:12 PM