我在GridView的footerRow想增加一个新建的按钮。代码如下:LinkButton mybutton = new LinkButton();
mybutton.Text = "新建";
mybutton.Click += new EventHandler(Button1_Click);
GridView1.FooterRow.Cells[0].Controls.Add(mybutton);原来是在GridView的Load事件下增加此代码的,后来我发现一旦运行删除事件,就没有执行此增加新键按钮的方法。我就在GridView的RowDeleted事件中加上此代码,还是不行。我知道是因为在RowDeleted结束后,可能Gridview还没有呈现的原因。我想知道如何做,才能在删除后,也显示出这个新建的按钮,谢谢。
mybutton.Text = "新建";
mybutton.Click += new EventHandler(Button1_Click);
GridView1.FooterRow.Cells[0].Controls.Add(mybutton);原来是在GridView的Load事件下增加此代码的,后来我发现一旦运行删除事件,就没有执行此增加新键按钮的方法。我就在GridView的RowDeleted事件中加上此代码,还是不行。我知道是因为在RowDeleted结束后,可能Gridview还没有呈现的原因。我想知道如何做,才能在删除后,也显示出这个新建的按钮,谢谢。
<asp:TextBox ID="tbInsert" runat="server" Text="" ></asp:TextBox>
</FooterTemplate>http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspxoradd your above code in Page's Init or Load event handler
<FooterTemplate>
<asp:TextBox ID="tbInsert" runat="server" Text="" ></asp:TextBox>
</FooterTemplate>说并不骨FooterTemplate这个属性啊。
{
GridView1.DataBound +=new EventHandler(Page_Load);
}只要你在Page_Load事件中有增加控件就行了。