Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                getcon();
                string         str = "select group_name,group_id from tbl_group";
                SqlCommand     cmd = new SqlCommand(str, con);
                SqlDataAdapter ad  = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                ad.Fill(dt);
                {
                    DropDown_Group.DataSource     = dt;
                    DropDown_Group.DataTextField  = "group_name";
                    DropDown_Group.DataValueField = "group_id";
                    DropDown_Group.DataBind();
                    DropDown_Group.Items.Insert(0, "select");
                }

                con.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                getcon();
                string         str = "select group_name,group_id from tbl_group";
                SqlCommand     cmd = new SqlCommand(str, con);
                SqlDataAdapter ad  = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                ad.Fill(dt);
                {
                    DropDown_Group.DataSource     = dt;
                    DropDown_Group.DataTextField  = "group_name";
                    DropDown_Group.DataValueField = "group_id";
                    DropDown_Group.DataBind();
                    DropDown_Group.Items.Insert(0, "select");
                }

                DataTable  dtt = new DataTable();
                DataColumn dc  = new DataColumn("regid");
                DataColumn dc1 = new DataColumn("name");
                dtt.Columns.Add(dc);
                dtt.Columns.Add(dc1);
                Session["tbl"] = dtt;

                string         str1 = "select bloodgrp_name,bloodgrp_id from tbl_bloodgrp";
                SqlCommand     cmd1 = new SqlCommand(str1, con);
                SqlDataAdapter ad1  = new SqlDataAdapter(cmd1);
                DataTable      dt1  = new DataTable();
                ad1.Fill(dt1);
                {
                    DropDown_BldGrp.DataSource     = dt1;
                    DropDown_BldGrp.DataTextField  = "bloodgrp_name";
                    DropDown_BldGrp.DataValueField = "bloodgrp_id";
                    DropDown_BldGrp.DataBind();
                    DropDown_BldGrp.Items.Insert(0, "select");
                }

                string         str2 = "select country_name,country_id from tbl_country";
                SqlCommand     cmd2 = new SqlCommand(str2, con);
                SqlDataAdapter ad2  = new SqlDataAdapter(cmd2);
                DataTable      dt2  = new DataTable();
                ad2.Fill(dt2);
                {
                    DropDown_Country.DataSource     = dt2;
                    DropDown_Country.DataTextField  = "country_name";
                    DropDown_Country.DataValueField = "country_id";
                    DropDown_Country.DataBind();
                    DropDown_Country.Items.Insert(0, "select");
                }

                string         str3 = "select relationship_type,relationship_id from tbl_relationship";
                SqlCommand     cmd3 = new SqlCommand(str3, con);
                SqlDataAdapter ad3  = new SqlDataAdapter(cmd3);
                DataTable      dt3  = new DataTable();
                ad3.Fill(dt3);
                if (dt3.Rows.Count > 0)
                {
                    DropDown_Relationship.DataSource     = dt3;
                    DropDown_Relationship.DataTextField  = "relationship_type";
                    DropDown_Relationship.DataValueField = "relationship_id";
                    DropDown_Relationship.DataBind();
                    DropDown_Relationship.Items.Insert(0, "select");
                }


                con.Close();
            }
        }