Hello,
I am still pretty new to asp.net. I have a gridview bound to sql data and a footer that displays the summary info(totals of each column). The footer is populated in the Gridview.rowdatabound event. In my Gridview I am using template items with some columns consisting of textboxes to make the values editable for the users. What I would like to know is it possible to call the grdivew.rowdatabound event for a second time when a textbox in the gridview is changed (at OnTextChanged)? This would allow the footer to repopulate based on the values in the updated textbox. I would like to avoid using the update button in the gridview if possible.

Thank you in adavnce,
steve

Hello,
I am still pretty new to asp.net. I have a gridview bound to sql data and a footer that displays the summary info(totals of each column). The footer is populated in the Gridview.rowdatabound event. In my Gridview I am using template items with some columns consisting of textboxes to make the values editable for the users. What I would like to know is it possible to call the grdivew.rowdatabound event for a second time when a textbox in the gridview is changed (at OnTextChanged)? This would allow the footer to repopulate based on the values in the updated textbox. I would like to avoid using the update button in the gridview if possible.

Thank you in adavnce,
steve

Hi Steve

Have a look at the sample

aspx code

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" ShowFooter="True">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" />
                    <asp:CommandField ShowEditButton ="True" />
                    <asp:BoundField DataField="ProductID" HeaderText="ProductID" />
                    <asp:BoundField DataField="ProductCode" HeaderText="ProductCode" />
                    <asp:BoundField DataField="ProductName" HeaderText="ProductName" />
                    <asp:TemplateField HeaderText="Quantity">
                        <EditItemTemplate>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Qty") %>' Width="50px" MaxLength="3" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                            runat="server" 
                            ErrorMessage="You must enter Qty" 
                            ValidationGroup="v1" 
                            ControlToValidate="TextBox1" Display="None" SetFocusOnError="true"  ></asp:RequiredFieldValidator>
                            
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Price">
                        <EditItemTemplate>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("UnitPrice") %>' Width="80px" AutoPostBack="True" OnTextChanged="TextBox2_TextChanged"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
                            runat="server" ErrorMessage="You must enter price" 
                            ControlToValidate="TextBox2" SetFocusOnError="true" Display="None" ValidationGroup="v1"></asp:RequiredFieldValidator>
                        
                        </ItemTemplate>
                        
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Total">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Total") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Total") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                             <asp:TextBox ID="txtGrandTotal" runat="server" Width="69px"></asp:TextBox>
                        </FooterTemplate>
                        
                    </asp:TemplateField>
                    
                         
                </Columns>
               
            </asp:GridView>

.aspx.vb

Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim lbtn As LinkButton
            Dim txtPrice As Label

            lbtn = CType(e.Row.Cells(0).Controls(0), LinkButton)
            Dim drw As InvoiceDS.InvoiceRow
            drw = CType(CType(e.Row.DataItem, System.Data.DataRowView).Row, InvoiceDS.InvoiceRow)
            'lbtn.OnClientClick = String.Format("return confirm('Are you sure to delete the {0} Product');", drw.ProductName.ToString)
            Utility.ShowDeleteConfirmBox(lbtn, drw.ProductName.ToString)

            txtPrice = CType(e.Row.FindControl("Label1"), Label)
            If Not IsNothing(txtPrice) Then
                If txtPrice.Text <> "" Then

                    dblPrice += txtPrice.Text

                End If
                Session("dblPrice") = dblPrice
            End If

        End If
        If e.Row.RowType = DataControlRowType.Footer Then
            Dim txtTot As TextBox
            txtTot = CType(e.Row.FindControl("txtGrandTotal"), TextBox)
            If Not IsNothing(txtTot) Then
                txtTot.Text = dblPrice
            End If
        End If
    End Sub

Mark as solved if it helps you!!!