footer template not displaying in gridview

Posted by Ankitsrist under ASP.NET on 12/22/2012 | Points: 10 | Views : 4708 | Status : [Member] | Replies : 1
hey, i have a gridview in everything is working fine means editing updating etc but insert is not working..i have add footer template and given textboxes nd insert linkbutton....but it is not displaying....y it is happening any one please help
aspx code is somethng like below
<asp:TemplateField>
<EditItemTemplate>
<asp:Label ID="lbleditname" runat="server" Text='<%#Eval("name")%>'></asp:Label>
</EditItemTemplate>
<HeaderTemplate>
name
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("name")%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtn" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
&nbsp;<asp:TextBox ID="TextBox1" runat ="server" Text='<%#Eval("decription")%>'></asp:TextBox>
</EditItemTemplate>

nd asp.cs is as belows
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
dbc.myconnection();
if(e.CommandName.Equals("Add"))
{
TextBox txt1 = (TextBox)GridView1.FooterRow.FindControl("txtn");
TextBox txt2 = (TextBox)GridView1.FooterRow.FindControl("txtd");
SqlCommand cmd = new SqlCommand("insert into dmlwithingrid(name, decription)values('"+txt1 .Text +"', '"+txt2 .Text +"')", dbc .sqlcon );
cmd.ExecuteNonQuery();
}

}





Responses

Posted by: Ankitsrist on: 12/22/2012 [Member] Starter | Points: 25

Up
0
Down
replying to myself......ankit please go to the gridview property and set show footer property to "True".................dont arise silly queries

happy coding

Ankitsrist, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response