如何在default.aspx.cs中获取hiddenfield id名称? [英] How do I get a hiddenfield id name in default.aspx.cs?

查看:176
本文介绍了如何在default.aspx.cs中获取hiddenfield id名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处为Default.Aspx的标记代码

 <   asp:TemplateField     HeaderText   =  客户ID >  

< ItemTemplate >

< asp:HiddenField runat = server visible = true ID = HiddenField2 =' <% #Eval ( 客户ID)%>' > < / asp:HiddenField >

< asp:Label runat = server ID = HiddenField1 文字 =' <% #Eval( 客户ID)%>' 可见 = true > < / asp:Label >

< / ItemTemp延迟 >

< / asp:TemplateField >

解决方案

按照这个例子



http://stackoverflow.com/questions/6873973/how-to-find-control-in-templatefield-of-gridview [ ^ ]



只使用HiddenField而不是HyperLink,然后值在Value属性中。



或者这个例子如果你没有使用绑定事件< br $>


访问GridView中的不同控件控制 [ ^ ]

Here markup code for Default.Aspx

<asp:TemplateField HeaderText="Customer ID">

    <ItemTemplate>

        <asp:HiddenField runat="server" visible="true" ID ="HiddenField2"   Value='<%#Eval("Customer ID") %>'   ></asp:HiddenField>

            <asp:Label runat="server" ID="HiddenField1"  Text ='<%#Eval("Customer ID")%>' Visible="true" ></asp:Label>

    </ItemTemplate>

</asp:TemplateField>

解决方案

Follow this example

http://stackoverflow.com/questions/6873973/how-to-find-control-in-templatefield-of-gridview[^]

only use HiddenField rather than HyperLink, then the value is in the Value property.

Or this example if you're not using the bound event

Accessing the different controls inside a GridView control[^]


这篇关于如何在default.aspx.cs中获取hiddenfield id名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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