Hi, In header and footer there are no textboxes, right? and textboxes are in item template. I hope,you got my point...
On Fri, May 7, 2010 at 5:15 PM, Stephen Russell <[email protected]>wrote: > On Thu, May 6, 2010 at 10:50 AM, shookim <[email protected]> wrote: > > You need to pass either the row # or the value here because > CType(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), > TextBox).Text e.RowIndex is not valid in this sub. > > > > > -----vb code---- > > Sub BindData() > > > > Dim strSqlConnection As String = > > ConfigurationManager.AppSettings("ConnectionString") > > Dim strSqlStatement As String > > Dim sqlConn As SqlConnection > > Dim dsAdSignup As New DataSet > > Dim objDS = New DataSet > > > > objDS.DataSetName = "dsAdSignup" > > sqlConn = New SqlConnection(strSqlConnection) > > > > strSqlStatement = "select * from tblAdSignup" > > > > Dim cmd As SqlCommand > > Dim dataAdapter As New SqlDataAdapter > > > > cmd = New SqlCommand(strSqlStatement, sqlConn) > > > > dataAdapter.SelectCommand = cmd > > dataAdapter.Fill(dsAdSignup) > > GridView1.DataSource = dsAdSignup > > GridView1.DataBind() > > > > End Sub > > > > Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e > > As GridViewUpdateEventArgs) > > > > ID = GridView1.DataKeys(e.RowIndex).Value > > Dim txtAddress As String > > txtAddress = > > CType(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), > > TextBox).Text <----this is where it bombs > > > > End Sub > > > > > > -------END CODE------ > > > > txtAddress = > > CType(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), > > TextBox).Text is where it is bombing, help! > > > > > > -- > Stephen Russell > > Sr. Production Systems Programmer > CIMSgts > > 901.246-0159 cell > -- "People who never make mistakes, never do anything." dEv
