ASP.NET 扩展 gridview 以在 gridview 下方显示导航栏?
我开发了一个继承自 gridview 的 asp.net 控件,它被称为 gridviewex...我需要一些页面导航内容在它下面呈现,以用于我正在实现的一些自定义分页..一切顺利,但我似乎无法向控件添加新控件。
例如,我想做的是在网格下方添加一个 asp.net 面板,然后向面板添加链接按钮。
到目前为止我已经有了这个,但它给出了一个错误
Unable to cast object of type 'System.Web.UI.WebControls.Panel' to type
'System.Web.UI.WebControls.Table'.
代码..
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Panel uxGridViewNavigation = new Panel();
LinkButton linkButton = null;
linkButton = new LinkButton();
linkButton.Text = "First";
linkButton.Click += new EventHandler(linkButton_Click);
uxGridViewNavigation.Controls.Add(linkButton);
this.Controls.Add(uxGridViewNavigation);
}
我真的很感激任何帮助。这是我的第一个服务器控制扩展:-)
谢谢
I have developed an asp.net control that inherits from the gridview and its called gridviewex... i need some page navigation stuff to render underneath it for some custom paging that i am implenting.. All going well but i can't seem to add new controls to the controls..
For example what i wanted to do is add a asp.net Panel underneath the grid and than add linkbuttons to the panel.
I have this so far but it gives an error
Unable to cast object of type 'System.Web.UI.WebControls.Panel' to type
'System.Web.UI.WebControls.Table'.
The code..
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Panel uxGridViewNavigation = new Panel();
LinkButton linkButton = null;
linkButton = new LinkButton();
linkButton.Text = "First";
linkButton.Click += new EventHandler(linkButton_Click);
uxGridViewNavigation.Controls.Add(linkButton);
this.Controls.Add(uxGridViewNavigation);
}
I would really appreciated any help. Its my first server control extension :-)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重写
Render
,如下所示:Override
Render
like: