在网格视图的标题模板中插入文本框 [英] Inserting Text box in header template of grid view

查看:93
本文介绍了在网格视图的标题模板中插入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

我试图在标题模板中插入一个文本,如下面的代码:---

Hello All,
I am trying to insert a text inside a header template like the below code:---

<asp:TemplateField HeaderText="PlanningId" ItemStyle-CssClass="TACenter">
        <HeaderTemplate>
         Planning Id<br />
            <asp:TextBox ID="txt_planningid" runat="server"></asp:TextBox>
        </HeaderTemplate>
        </asp:TemplateField>







但在执行上述代码时我收到以下错误: -



无法投射对象pe''System.Web.UI.LiteralControl''键入''System.Web.UI.WebControls.LinkBut​​ton''。





请尽快给我解决方案,紧急。



谢谢




But While doing the above code i am getting the following error:-

Unable to cast object of type ''System.Web.UI.LiteralControl'' to type ''System.Web.UI.WebControls.LinkButton''.


Please give me solution as early as possible,its urgent.

Thank you

推荐答案

In标题,你不能使用控件。

如果你的标题是动态的;然后使用标签在页面顶部。
In header, you cannot use controls.
If your Heading will be dynamic; then use Label On the top of your Page.


http:// forums .asp.net / t / 1228689.aspx / 1 [ ^ ]


我在gridview中使用了排序。它正在使用System.Web.UI.WebControls的一些sortdirection变量。当我从我的页面中删除排序时,没有例外。
I have used sorting in gridview.It was using some sortdirection variable of System.Web.UI.WebControls .And when i removed sorting from my page,there was no exception.


这篇关于在网格视图的标题模板中插入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆