Gridview - edititemtemplate标记问题 [英] Gridview - edititemtemplate tag problem

查看:69
本文介绍了Gridview - edititemtemplate标记问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想要一个包含要编辑的文本框的Gridview,以及一个验证文本框值的Validate控件。但当我把两个控件放在< itemtemplate>下时标签我可以看到文本框但是如果我把它放在< edititemtemplate>下面标签我看不到文本框。



这是我的代码...



< pre lang =xml> < asp:TemplateField HeaderText = 排序顺序 SortExpression = Sort_Order meta:resourcekey = APPROVAL_STATUSResource >
< itemstyle width = 10% horizo​​ntalalign = right > < / itemstyle >
< ; headerstyle width < span class =code-keyword> = 10% horizo​​ntalalign = right > < / headerstyle >
< EditItemTemplate >
< asp:TextBox runat = server 文字 =' <% #Bind( Sort_Order%> ' ID = txtSortOrder > < / asp:TextBo x >
< asp:CompareValidator ControlToValidate = txtSortOrder 运算符 = GreaterThanEqual 类型 = 整数 ValueToCompare = 0 ErrorMessage = 排序顺序字段不能为负数。 显示 = runat = 服务器 / >
< / EditItemTemplate >
< / asp:TemplateField >

解决方案

嗨检查一下?



 <   asp:TemplateField     HeaderText   =  StudentName      SortExpression   =  StudentName >  
< EditItemTemplate >
< asp:TextBox ID = txtStudentName runat = server < span class =code-attribute>宽度
= 85px 文字 =' <% #Eval( StudentName%> ' / >
< / EditItemTemplate >

< ItemTemplate >
< asp:标签 ID = lblStudentName runat = server 文字 =' <% #Eval( StudentName %> ' / >
< / ItemTemplate >

< FooterTemplate < span class =code-keyword>>
< asp:TextBox ID = txtFTRStudentName runat = 服务器 宽度 = 85px / >
< asp:RequiredFieldValidator ID = rfvStudentName runat = server ControlToValidate = txtFTRStudentName 文字 = * ValidationGroup = 验证 / < span class =code-keyword>>

< / FooterTemplate >

< / asp:TemplateField >







当然,这对你有帮助。


Hi,

I want a Gridview which contains a textbox to edit and with a Validate control which will validate the text box value. But when I put the two controls under <itemtemplate> tag I can see the textbox but if I put the same under <edititemtemplate> tag I can''t see the textbox.

Here is my code...

<asp:TemplateField HeaderText="Sort Order" SortExpression="Sort_Order" meta:resourcekey="APPROVAL_STATUSResource">
     <itemstyle width="10%" horizontalalign="right"></itemstyle>
     <headerstyle width="10%" horizontalalign="right" ></headerstyle>
     <EditItemTemplate>
     <asp:TextBox runat="server" Text='<%#Bind("Sort_Order") %>' ID="txtSortOrder" ></asp:TextBox>
     <asp:CompareValidator ControlToValidate="txtSortOrder" Operator="GreaterThanEqual" Type="Integer" ValueToCompare="0" ErrorMessage="The Sort Order Field cannot be negative." Display="None" runat="server" />
     </EditItemTemplate>
</asp:TemplateField>

解决方案

Hi Check this ?

<asp:TemplateField HeaderText="StudentName"  SortExpression="StudentName">
 <EditItemTemplate>
 <asp:TextBox ID="txtStudentName" runat="server" Width="85px" Text='<%#Eval("StudentName") %>'/>
 </EditItemTemplate>

 <ItemTemplate>
 <asp:Label ID="lblStudentName" runat="server" Text='<%#Eval("StudentName") %>'/>
 </ItemTemplate>

 <FooterTemplate>
 <asp:TextBox ID="txtFTRStudentName" runat="server" Width="85px"/>
 <asp:RequiredFieldValidator ID="rfvStudentName" runat="server" ControlToValidate="txtFTRStudentName" Text="*" ValidationGroup="validation"/>
 </FooterTemplate>

 </asp:TemplateField>




Sure , this will help you.


这篇关于Gridview - edititemtemplate标记问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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