DataTable dt=new Datatable(); //fill dt with data and store it in viewstate to persist its value in page during postbacks. //store value in view state ViewState["MyTable"]=dt; //get value from view state DataTable dt=(DataTable)ViewState["MyTable"]; string strUser=string)
<%@ Page EnableSessionState="False" %>
<configuration> <system.web> <pages enableSessionState="false" /> </system.web> </configuration>
<%@ Page EnableSessionState="true" %>
<configuration> <system.web> <pages enableSessionState="ReadOnly" /> </system.web> </configuration>
<%@ Page EnableViewState="false" %>
<%@ Page Language="C#" AutoEventWireUp="true" Trace="True" %>
DataSet objDS = new DataSet(); objDS.ReadXml("myfile.xml", XmlReadMode.ReadSchema);
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //code that runs first time not execute when page is post back. } }
MyUserControl.ascx <%@ OutputCache Duration='100' VaryByParam='none' %>
try { } catch { } finally { return;//compile time error: Control cannot leave the body of a finally clause
<configuration> <system.web> <pages theme=”BlueMoon” /> </system.web> </configuration>