Concerned with footerrow in gridview

Posted by ramyatk06 on Stack Overflow See other posts from Stack Overflow or by ramyatk06
Published on 2009-12-16T17:18:20Z Indexed on 2010/04/16 0:03 UTC
Read the original article Hit count: 241

Filed under:
|

hi guys, I have following gridview.

 <asp:GridView ID="gvMarks" runat="server" AutoGenerateColumns="false" 
   DataKeyNames="MarkId" Width="80%" onrowdatabound="gvMarks_RowDataBound" 
   ShowFooter="True" onrowcommand="gvMarks_RowCommand">
    <Columns>
        <asp:TemplateField>
            <HeaderTemplate>
                SubjectCode
            </HeaderTemplate>
          <FooterTemplate>
            <asp:DropDownList ID="dlSubjectCode" runat="server" width="100px" AutoPostBack="false"></asp:DropDownList>
          </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <HeaderTemplate>
               Mark
            </HeaderTemplate>
              <FooterTemplate>
                <asp:TextBox ID="txtInternalMark" runat="server" ></asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>

        <asp:TemplateField>
            <HeaderTemplate>
              Insert
            </HeaderTemplate>
            <FooterTemplate>
                <asp:LinkButton ID="lnkInsert" runat="server" Text="Insert" 
                    CommandName="Insert" ></asp:LinkButton>
            </FooterTemplate>
        </asp:TemplateField>
    </Columns>
    <FooterStyle BackColor="White" ForeColor="#000066" />
    <RowStyle ForeColor="#000066" />
    <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>

If i enter some value in txtInternalMark,iam not geting its value in code behind.Iam geting the value as "".Iam using following code

if (e.CommandName.Equals("Insert"))
{
    TextBox txtInternalMark = (TextBox)gvMarks.FooterRow.FindControl("txtInternalMark");
    lblMessage.Text = txtInternalMark .Text;
}

Can anybody help to get the value of textbox in codebehind.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET