[英]Disable ViewState for asp: Linkbutton
I have two link buttons in my index.aspx 我的index.aspx中有两个链接按钮
<form id="MyForm" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="subscriptionPanel" runat="server" ValidationGroup="SubscriptionGroup">
<ContentTemplate>
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope"></i></span>
<asp:TextBox ID="txtEmail" runat="server" CssClass="form-control" autocomplete="off" placeholder="your@email.com" ValidationGroup="SubscriptionGroup"></asp:TextBox><br />
</div>
<br />
<asp:Button ID="btnSubscribe" runat="server" Text="Subscribe Now!" CssClass="btn btn-large" OnClick="btnSubscribe_Click" ValidationGroup="SubscriptionGroup" />
<li style="visibility: hidden;">
<asp:LinkButton ID="LinkButton1" runat="server" EnableViewState="false" OnClick="btnHindiCulture" ValidationGroup="HindiLanguage" CausesValidation="false">Hindi</asp:LinkButton></li>
<%--<asp:Button ID="btnHidden" runat="server" Text="Hidden" OnClick="btnHidden_Click" />--%>
</ContentTemplate>
</asp:UpdatePanel>
</form>
I want to disable Viewstate for the LinkButton1 for which I am using EnableViewState="false". 我想为我正在使用EnableViewState =“ false”的LinkButton1禁用Viewstate。 Still I am getting ViewState Data in Request.Form.
我仍然在Request.Form中获取ViewState数据。
ViewStateData is as shown in below image: ViewStateData如下图所示:
How can I disable viewstate data for this? 我如何为此禁用视图状态数据?
In the .NET framework 4. Put below tag in page directive: 在.NET Framework 4中。将以下标记放在page指令中:
ViewStateMode="Disabled"
and use this for each controls that want to save the Viewstate (eg): 并将其用于要保存Viewstate的每个控件(例如):
<asp:DropDownList ID="ddl" runat="server" ViewStateMode="Enabled">
</asp:DropDownList>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.