protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PanelLogin.Visible = false; if (!IsPostBack) { if (Cache["DS"] == null) { this.LoadFromDb(); } DataSet ds = (DataSet)Cache["DS"]; DropDownListSource.DataSource = ds.Tables["Districts"]; DropDownListDestination.DataSource = ds.Tables["Districts"]; DropDownListSource.DataTextField = "DistrictName"; DropDownListSource.DataValueField = "DistrictId"; DropDownListDestination.DataTextField = "DistrictName"; DropDownListDestination.DataValueField = "DistrictId"; DropDownListSource.DataBind(); DropDownListDestination.DataBind(); } } if (Session["id"] != null) { Response.Redirect("~\\Admin.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Redirect("~\\Index.aspx"); } if (!IsPostBack) { if (Cache["DS"] == null) { this.LoadFromDb(); } DataSet ds = (DataSet)Cache["DS"]; DropDownListSource.DataSource = ds.Tables["Districts"]; DropDownListDestination.DataSource = ds.Tables["Districts"]; DropDownListSource.DataTextField = "DistrictName"; DropDownListSource.DataValueField = "DistrictId"; DropDownListDestination.DataTextField = "DistrictName"; DropDownListDestination.DataValueField = "DistrictId"; DropDownListSource.DataBind(); DropDownListDestination.DataBind(); } lblErrorMsgDlist.Text = ""; lblerrormsg.Text = ""; }