private void Clear()
    {
        if (DDLExamSession.SelectedIndex > 0)
        {
            DDLExamSession.SelectedIndex = 0;
        }
        if (DDLExamYear.SelectedIndex > 0)
        {
            DDLExamYear.SelectedIndex = 0;
        }
        if (DDLApply.SelectedIndex > 0)
        {
            DDLApply.SelectedIndex = 0;
        }

        TxtStuName.Text              = txtRollNo.Text = TxtRmark.Text = lblSms.Text = txtRecieptNo.Text = txtRecieptAmt.Text =
            txtRecieptDate.Text      = TxtRmark.Text = "";
        DDLApply.Enabled             = DDLExamSession.Enabled = DDLExamYear.Enabled = TxtRmark.Enabled = TxtStuName.Enabled = txtRollNo.Enabled = true;
        GridStudentDetail.DataSource = null;
        GridStudentDetail.DataBind();
        Panel1.Visible      = false;
        LblSearchCount.Text = "";
        FoilImgPath         = CFImgPath = "";

        DDLExamYear.Focus();
        //Response.Redirect("FrmStudentDetail.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                //pnlcheck.Visible = false;
                if (Session["UserId"] != null)
                {
                    UserId = Convert.ToString(Session["UserId"]);
                }

                TxtRmark.Enabled = false;
                BindExamYear();
                DDLExamYear.Items.Insert(0, new ListItem("Select Year", "0"));
                DDLExamYear.Focus();
                BindExamSession();
                DDLExamSession.Items.Insert(0, new ListItem("Select Session", "0"));
                //DDLExamSession.Focus();
                BindForApply();
                DDLApply.Items.Insert(0, new ListItem("Select Applied For", "0"));
                //DDLApply.Focus();
                BtnSave.Enabled = true;
                pendingData();
                Panel1.Visible = false;
                //string sysDate = System.DateTime.Now.ToShortDateString();
                //txtRecieptDate.Text = sysDate.Substring(0, 2) + "/" + sysDate.Substring(3, 2) + "/" + sysDate.Substring(6, 4);
                LblSearchCount.Text = "";
            }
            catch (Exception ex)
            {
                lblSms.Text = ex.Message;
            }
        }
    }
    private void BindExamYear()   // Exam Year Purpose
    {
        objplstudetail.Ind = 3;
        HttpClient HClient = new HttpClient();

        HClient.BaseAddress = new Uri(DataAcces.Url);
        HClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        objplstudentDetail = new PlStudentDetail();
        var uri      = "api/StudentDetail/GetExamYear/";
        var response = HClient.GetAsync(uri).Result;

        if (response.IsSuccessStatusCode)
        {
            var getdata = response.Content.ReadAsAsync <IEnumerable <PlStudentDetail> >().Result;
            if (getdata.Count() > 0)
            {
                DDLExamYear.DataSource     = getdata;
                DDLExamYear.DataValueField = "ItemID";
                DDLExamYear.DataTextField  = "ItemDesc";
                DDLExamYear.DataBind();
            }
            getdata = null;
        }
        response = null; uri = null;
    }
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        TxtRmark.Enabled = true;
        lblSms.Text      = "";
        int c = 0;

        if (DDLExamYear.SelectedIndex != 0)
        {
            //c = 1;
            if (DDLExamSession.SelectedIndex != 0)
            {
                if (txtRollNo.Text != "" || TxtStuName.Text != "")
                {
                    c = 1;
                    if (c == 1 && DDLApply.SelectedIndex != 0)
                    {
                        SearchDetail();
                    }
                    else
                    {
                        lblSms.Text = "Please Select Applied For.";
                        DDLApply.Focus();
                    }
                }
                else
                {
                    lblSms.Text = "Please Enter Roll No. Or Student Name.";
                    txtRollNo.Focus();
                }
            }
            else
            {
                lblSms.Text = "Please Select Exam Session.";
                DDLExamSession.Focus();
            }

            foreach (GridViewRow rw in GridStudentDetail.Rows)
            {
                CheckBox chkBx = (CheckBox)rw.FindControl("CheckBox1");
                if (GridStudentDetail.Rows.Count == 1)
                {
                    chkBx.Checked = true;
                }
                else
                {
                    chkBx.Checked = false;
                }
            }
        }
        else
        {
            lblSms.Text = "Please Select Exam Year.";
            DDLExamYear.Focus();
        }
    }