本文介绍了在后面的代码中获取隐藏的字段值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在后面的代码中获取hiddenfield的值?
How can I get the value of the hiddenfield in code behind?
<telerik:RadRotator ID="RadRotator1" RotatorType="AutomaticAdvance" ScrollDirection="Up"
ScrollDuration="4000" runat="server" Width="714"
ItemWidth="695" Height="260px" ItemHeight="70" FrameDuration="1" InitialItemIndex="-1"
CssClass="rotator">
<ItemTemplate>
<div class="itemTemplate" style="background-image: url('IMAGES3/<%# this.GetDayOfWeek(XPath("pubDate").ToString()) %>.png');">
<div class="dateTime">
<div class="time">
<%# (this.GetTimeOnly(XPath("pubDate").ToString())) %>
</div>
<div class="date">
<%# (this.GetDateOnly(XPath("pubDate").ToString()))%>
</div>
</div>
<div class="title">
<span>
<%# System.Web.HttpUtility.HtmlEncode(XPath("title").ToString())%>
</span>
</div>
<div class="buttonDiv">
<asp:Button ID="Button1" class="button" runat="server" Text="View" OnClientClick="OnClick" />
THIS HIDDENFIELD >>>>> <asp:HiddenField id="rssLink" runat="server" value='<%= System.Web.HttpUtility.HtmlEncode(XPath("link").ToString()%>' />
</div>
<div class="description">
<span>
<%# System.Web.HttpUtility.HtmlEncode(XPath("description").ToString())%>
</span>
</div>
</div>
</ItemTemplate>
</telerik:RadRotator>
隐藏字段位于RadRotator内部,我正在努力在代码中获取它的价值.
The hidden field is inside a RadRotator and I am battling to get the value of it in code behind.
推荐答案
您可以使用它的值属性
var value = this.rssLink.Value;
对于Telerik控件,您似乎需要在Databind上使用FindControl-有一个此处的文章.
for the telerik control it looks like you'll need to use FindControl on the Databind - there's an article here.
这篇关于在后面的代码中获取隐藏的字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!