[英]Disable ViewState for asp: Linkbutton
我的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>
我想為我正在使用EnableViewState =“ false”的LinkButton1禁用Viewstate。 我仍然在Request.Form中獲取ViewState數據。
ViewStateData如下圖所示:
我如何為此禁用視圖狀態數據?
在.NET Framework 4中。將以下標記放在page指令中:
ViewStateMode="Disabled"
並將其用於要保存Viewstate的每個控件(例如):
<asp:DropDownList ID="ddl" runat="server" ViewStateMode="Enabled">
</asp:DropDownList>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.