// Bind Student I-Card Data

        #region Student I Card

        private void StudentViewId(int OrgID, long StudentID)
        {
            DataSet ds;

            try
            {
                objEWA.OrgId        = OrgID;
                objEWA.StudentID    = StudentID;
                pnlContents.Visible = true;

                ds = objBAL.BL_StudentViewId(objEWA);

                //  lblTrustName.Text = ds.Tables[0].Rows[0]["TrustName"].ToString();
                lblCollageFullName.Text = ds.Tables[0].Rows[0]["OrgName"].ToString();

                lbldate.Text = Convert.ToString(Session["AcademicYear"]);

                string strFirstName  = ds.Tables[0].Rows[0]["FirstName"].ToString();
                string strMiddleName = ds.Tables[0].Rows[0]["MiddleName"].ToString();
                string strLastName   = ds.Tables[0].Rows[0]["LastName"].ToString();
                //  string fullname = strFirstName + ' ' + "" + ' ' + strMiddleName + ' ' + "" + ' ' + strLastName;
                string strFullName = strFirstName + ' ' + "" + ' ' + strMiddleName + ' ' + "" + ' ' + strLastName;
                lblName.Text = strFullName;

                lblStudentId.Text = ds.Tables[0].Rows[0]["UserCOde"].ToString();
                string DateofBirth = ds.Tables[0].Rows[0]["BirthDate"].ToString();

                DateTime DOB = Convert.ToDateTime(DateofBirth);

                lblDOB.Text = DOB.ToShortDateString();

                lblStream.Text = ddlclass.SelectedItem.ToString();
                lblCourse.Text = ddlcourse.SelectedItem.ToString();

                lblCurrentAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString();
                //Permanent address.
                //  lblPermanentAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString();
                //lblEmail.Text = ds.Tables[0].Rows[0]["EMail"].ToString();
                lblbloodGroup.Text     = ds.Tables[0].Rows[0]["BloodGroup"].ToString();
                lblParentConctact.Text = ds.Tables[0].Rows[0]["ParentMobile"].ToString();


                lblAdharCard.Text = ds.Tables[0].Rows[0]["LevelPlayed"].ToString();

                string Photo = ds.Tables[0].Rows[0]["Logo"].ToString();

                if (Photo != null && Photo != "")
                {
                    Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["Logo"];

                    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
                    imgClgLogo.ImageUrl = "data:image/png;base64," + base64String;
                }

                //for student photo
                string Photo1 = ds.Tables[0].Rows[0]["Photo"].ToString();

                if (Photo1 != null && Photo1 != "")
                {
                    Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["Photo"];

                    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
                    imgStud.ImageUrl = "data:image/png;base64," + base64String;
                }

                // BAR CODE GENERATOR CODE

                string barCode = ds.Tables[0].Rows[0]["UserCOde"].ToString();

                System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                using (Bitmap bitMap = new Bitmap(barCode.Length * 40, 80))
                {
                    using (Graphics graphics = Graphics.FromImage(bitMap))
                    {
                        Font       oFont      = new Font("IDAutomationHC39M", 16);
                        PointF     point      = new PointF(2f, 2f);
                        SolidBrush blackBrush = new SolidBrush(Color.Black);
                        SolidBrush whiteBrush = new SolidBrush(Color.White);
                        graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);//bitMap.Width, bitMap.Height);
                        graphics.DrawString("*" + barCode + "*", oFont, blackBrush, point);
                    }
                    using (MemoryStream ms = new MemoryStream())
                    {
                        bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] byteImage = ms.ToArray();

                        Convert.ToBase64String(byteImage);
                        //  imgBarcode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                    }
                    // imgBarcode.Controls.Add(imgBarCode);
                }

                // END OF BARCODE CODE
            }

            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
        protected void btnPrintLoad_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt  = new DataTable();
                DataTable dt1 = new DataTable();
                DataTable dt2 = new DataTable();

                dt.Columns.Add("imgClgLogo");
                dt.Columns.Add("CollageFullName");
                dt.Columns.Add("Stud");
                dt.Columns.Add("Name");
                dt.Columns.Add("StudentId");
                dt.Columns.Add("DOB");
                dt.Columns.Add("bloodGroup");
                dt.Columns.Add("Stream");
                dt.Columns.Add("Conctact");
                dt.Columns.Add("AdharCard");
                dt.Columns.Add("CurrentAddress");
                dt.Columns.Add("Sign");


                dt1.Columns.Add("imgClgLogo");
                dt1.Columns.Add("CollageFullName");
                dt1.Columns.Add("Stud");
                dt1.Columns.Add("Name");
                dt1.Columns.Add("StudentId");
                dt1.Columns.Add("DOB");
                dt1.Columns.Add("bloodGroup");
                dt1.Columns.Add("Stream");
                dt1.Columns.Add("Conctact");
                dt1.Columns.Add("AdharCard");
                dt1.Columns.Add("CurrentAddress");
                dt1.Columns.Add("Sign");


                dt2.Columns.Add("imgClgLogo");
                dt2.Columns.Add("CollageFullName");
                dt2.Columns.Add("Stud");
                dt2.Columns.Add("Name");
                dt2.Columns.Add("StudentId");
                dt2.Columns.Add("DOB");
                dt2.Columns.Add("bloodGroup");
                dt2.Columns.Add("Stream");
                dt2.Columns.Add("Conctact");
                dt2.Columns.Add("AdharCard");
                dt2.Columns.Add("CurrentAddress");
                dt2.Columns.Add("Sign");


                int flag = 0, i = 1;
                foreach (GridViewRow gvrow in grdIcard.Rows)
                {
                    CheckBox chk = (CheckBox)gvrow.FindControl("checkbox");


                    if (chk != null && chk.Checked)
                    {
                        DataRow dr;

                        if (i % 3 == 0)
                        {
                            dr = dt2.NewRow();
                        }
                        else if (i % 2 != 0)
                        {
                            dr = dt.NewRow();
                        }
                        else
                        {
                            dr = dt1.NewRow();
                        }

                        flag             = 1;
                        objEWA.OrgId     = OrgID;
                        objEWA.StudentID = Convert.ToInt32(grdIcard.DataKeys[gvrow.RowIndex].Values["UserCode"].ToString());

                        ds = objBAL.BL_StudentViewId(objEWA);

                        string   DateofBirth = ds.Tables[0].Rows[0]["BirthDate"].ToString();
                        DateTime DOB         = Convert.ToDateTime(DateofBirth);

                        string Photo     = ds.Tables[0].Rows[0]["Logo"].ToString();
                        string ImageUrl1 = null;
                        if (Photo != null && Photo != "")
                        {
                            Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["Logo"];

                            string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
                            ImageUrl1 = "data:image/png;base64," + base64String;
                        }

                        //for student photo
                        string Photo1    = ds.Tables[0].Rows[0]["Photo"].ToString();
                        string ImageUrl2 = null;
                        if (Photo1 != null && Photo1 != "")
                        {
                            Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["Photo"];

                            string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
                            ImageUrl2 = "data:image/png;base64," + base64String;
                        }

                        dr[0]  = ImageUrl1;
                        dr[1]  = ds.Tables[0].Rows[0]["OrgName"].ToString();
                        dr[2]  = ImageUrl2;
                        dr[3]  = ds.Tables[0].Rows[0]["FirstName"].ToString() + " " + ds.Tables[0].Rows[0]["MiddleName"].ToString() + " " + ds.Tables[0].Rows[0]["LastName"].ToString();
                        dr[4]  = ds.Tables[0].Rows[0]["UserCOde"].ToString();
                        dr[5]  = DOB.ToString("dd-MMM-yyyy");
                        dr[6]  = ds.Tables[0].Rows[0]["BloodGroup"].ToString();
                        dr[7]  = ddlbranch.SelectedItem.ToString() + " " + ddlclass.SelectedItem.ToString();
                        dr[8]  = ds.Tables[0].Rows[0]["Mobile"].ToString();
                        dr[9]  = ds.Tables[0].Rows[0]["AdharNo"].ToString();
                        dr[10] = ds.Tables[0].Rows[0]["Address1"].ToString();
                        dr[11] = "../../Sign/" + OrgID + ".png";

                        if (i % 3 == 0)
                        {
                            dt2.Rows.Add(dr);
                        }
                        else if (i % 2 != 0)
                        {
                            dt.Rows.Add(dr);
                        }
                        else
                        {
                            dt1.Rows.Add(dr);
                        }

                        i++;
                    }
                }

                if (flag > 0)
                {
                    Repeater1.DataSource = dt;
                    Repeater1.DataBind();

                    Repeater2.DataSource = dt1;
                    Repeater2.DataBind();

                    Repeater3.DataSource = dt2;
                    Repeater3.DataBind();

                    btnPrint.Visible = true;
                    //  pnlContents.Visible = true;
                }
                else
                {
                    Repeater1.DataSource = null;
                    Repeater1.DataBind();

                    Repeater2.DataSource = null;
                    Repeater2.DataBind();

                    Repeater3.DataSource = null;
                    Repeater3.DataBind();

                    btnPrint.Visible = false;
                    // pnlContents.Visible = false;

                    msgBox.ShowMessage("Atlist One student select..!", "Critical", UserControls.MessageBox.MessageStyle.Critical);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }