I have question regarding ViewState I want to disable a ViewState From CodeBehind because the Control Which I have used in my Application which can be used for many clients so it's not possible to Disable ViewState from UI side.
I have a Control like
<%@ Control Language="C#" ClassName="allrealTimeHorizonAndChartControls" Inherits="QFlife.IrApps.SM6.TimeControl" %>
<div style="float:left; width: 570px; border-top:1px solid #EDEDED;" class="borderright">
<div style="float:left; width:570px">
<input ID="Submit1" class="update_button" type="submit" value="<%= IRAppMgr.Translate("command_update") %>" />
</div>
<%--<div class="HelpButton" style="float:left; width:285px">
<% string culturename = ""; %>
<% culturename = IRAppMgr.UiCulture.Name; %>
<a class="help" target="_blank" href="http://ir.quartalflife.com/qmip/qsm/public_html/sm6help/navigation_en-US.jsp">
help
</a>
</div>--%>
</div>
<asp:ObjectDataSource ID="SharesDS" runat="server" DataObjectTypeName="Qfx.DataClasses.Config.Option"
SelectMethod="SelectOptions" TypeName="Qfx.Bases.data.DataManager">
<SelectParameters>
<asp:ControlParameter ControlID="ClientMarker" Name="appConfig" PropertyName="Config"
Type="Object" />
<asp:ControlParameter ControlID="ClientMarker" Name="client" PropertyName="Client" />
<asp:Parameter Name="selection" DefaultValue="shares" />
</SelectParameters>
</asp:ObjectDataSource>
I want to Disable ViewState Only for ObjectDataSource,
Now I want to do Something on my Qfx.Bases.data.DataManager Class so it shoule be apply for all clients .
My DataManager class look like
public class DataManager
{
//All Code Goes Here
}
I have tried below menioned code
Page P = HttpContext.Current.Handler as Page;
P.ViewStateMode = ViewStateMode.Disabled;
but I got HttpContext.Current.Handler is null
can anyone please suggest me how could I achive this.
CustomObjectDataSource- Philip Pittle