Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ConnKey = Session["ConnStr"].ToString();
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                Response.Redirect("~/Error.aspx");
            }
        }
        if (Session["Role"].ToString() == null || Session["Role"].ToString() != "1")
        {
            Response.Redirect("~/Error.aspx");
        }

        if (!IsPostBack)
        {
            try
            {
                imgstate.ImageUrl = "~/img/" + Session["statecd"].ToString().Trim() + ".png";
                lblstatename.Text = "GOVERNMENT OF " + Session["statename"].ToString();
                lblUsrName.Text   = Session["UsrName"].ToString();
                lblDate.Text      = DateTime.Now.ToString("dd-MM-yyyy");
                StateCode         = Session["StateCd"].ToString();
                /*Bind States - By Default set State as TELANGANA*/
                ddt = objMstBL.getstate(ConnKey);
                objCommon.BindDropDownLists(ddl_State, ddt, "StateName", "StateCode", "0");
                ddl_State.SelectedValue = StateCode;
                ddl_State.Enabled       = false;
                /*Bind Districts*/
                ddt = objMstBL.getDistrictsByStateCodeBAL(ddl_State.SelectedValue.ToString(), ConnKey);
                objCommon.BindDropDownLists(ddl_dist_code, ddt, "DistName", "DistCode", "0");
                //ddt = objDist.getstate(ConnKey);
                //objCommon.BindDropDownLists(ddl_State, ddt, "StateName", "StateCode", "0");

                ddt = objDist.viewInstitutiondataBAL(ConnKey);
                objCommon.BindDropDownLists(ddl_InsType, ddt, "InstitutionTypeDesc", "InstitutionTypeCode", "0");

                ddt = objDist.GetUserTypeBAL(ConnKey);
                objCommon.BindDropDownLists(ddl_Role, ddt, "Role_Name", "Role_ID", "0");
            }

            catch (Exception ex)
            {
                Response.Redirect("~/Error.aspx");
            }
        }
    }