المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Problem with add linkbutton to a footer of a gridview runtime!!!



C# Programming
07-28-2009, 11:30 AM
I use the following code to add linkbutton to footer of a grideview, but it cause error sometimes!!!!!

In my computer as local server it works, but another users see the error.


LinkButton lbtn = new LinkButton();
lbtn.Text = " |< ";
Panel pnl = GridView1.FooterRow.FindControl("pnlFooter") as Panel ;
lbtn.CommandArgument = (pageindex).ToString();
lbtn.Command += new CommandEventHandler(lbtn_Command);
pnl.Controls.Add(lbtn);



the error accurs at line

Panel pnl = GridView1.FooterRow.FindControl("pnlFooter") as Panel ;

what could I do to solve it?!!!! http://www.barakasoft.com/script/Forums/Images/smiley_doh.gif
any help would be useful!!

HTML For footer gridview: