Thanks Eder, but I've tried that, same error. On Thu, May 13, 2010 at 11:35 AM, Eder Sousa <[email protected]> wrote:
> after debuging try to use gridview.row(0).cell(0) > > On Wed, May 12, 2010 at 2:33 AM, ThanderMaX <[email protected]> > wrote: > > DEBUG YOUR OWN CODE!!!!!!!!! > > > > DEBUG YOUR OWN CODE!!!!!!!!! > > > > DEBUG YOUR OWN CODE!!!!!!!!! > > > > DEBUG YOUR OWN CODE!!!!!!!!! > > > > On May 8, 1:14 am, shookim <[email protected]> wrote: > >> I've been stuck on this error for a whole day!!! I've searced the > >> www, and can't find anything useful. In GridView1_RowUpdating is > >> where the code bombs, I've marked line below. Help! > >> > >> <asp:GridView id="GridView1" runat="server" CssClass="Grid" > >> DataKeyNames="ID" > >> AllowPaging="false" > >> OnRowEditing = "GridView1_RowEditing" > >> OnRowUpdating = "GridView1_RowUpdating" > >> AutoGenerateColumns="False" > >> EnableViewState="false" ShowFooter="true"> > >> <FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></ > >> FooterStyle> > >> <HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" > >> BackColor="#4A3C8C"></HeaderStyle> > >> <Columns> > >> <asp:TemplateField HeaderText="ID"> > >> <ItemTemplate> > >> <%#Eval("ID")%> > >> </ItemTemplate> > >> </asp:TemplateField> > >> <asp:CommandField ShowEditButton="true" EditText="Edit" > >> CausesValidation="false" /> > >> <asp:CommandField ShowDeleteButton="true" EditText="Delete" /> > >> <asp:TemplateField HeaderText="mlsnum"> > >> <EditItemTemplate> > >> <asp:TextBox ID="txtMls" runat="server" Text='<%# > >> Bind("mlsnum") %>'/> > >> </EditItemTemplate> > >> <ItemTemplate> > >> <%#Eval("mlsnum")%> > >> </ItemTemplate> > >> </asp:TemplateField> > >> <asp:TemplateField HeaderText="Address"> > >> <EditItemTemplate> > >> <asp:TextBox ID="txtAddress" runat="server" Text='<%# > >> Bind("Address") %>'/> > >> </EditItemTemplate> > >> <ItemTemplate> > >> <%#Eval("Address")%> > >> </ItemTemplate> > >> </asp:TemplateField> > >> --->end asp code > >> > >> -----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! > > > > > > -- > Eder Sousa > Technology Information > [email protected] > [email protected] > [email protected] > > > >
