开发者

Concerned with footerrow in gridview

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 开发者_JAVA技巧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.


Hai,

string Ingredient = ((TextBox) gvMarks.FooterRow.FindControl("txtInternalMark")).Text;

 Response.Write(Ingredient);

and if it doesn't work add CausesValidation="False" to ur linkbutton lnkInsert

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜