Hi
I have "Specialty" table with 2 fields (SPID,Specialty ).
To bind data from "Specialty: table to the dropdownlist during page load, I have given the following coding
protected void Page_Load(objec t sender, EventArgs e)
{
if (!Page.IsPostBa ck)
{
SqlConnection con = new SqlConnection(" user id=sa;password= cast;database=H ello_Dr;server= AURORA-SERVER;");
con.Open();
String sql = "select * from Specialty";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr1;
dr1 = cmd.ExecuteRead er();
//Speciality_Drop DownList.Items. Clear();
while (dr1.Read())
{
Specialty_DropD ownList.Items.A dd(dr1.GetValue (1).ToString()) ;
}
}}
But how can I bind both the column in the table by making 1 column hidden. That is making the specialty column binding based on specialty id.
I have "Specialty" table with 2 fields (SPID,Specialty ).
To bind data from "Specialty: table to the dropdownlist during page load, I have given the following coding
protected void Page_Load(objec t sender, EventArgs e)
{
if (!Page.IsPostBa ck)
{
SqlConnection con = new SqlConnection(" user id=sa;password= cast;database=H ello_Dr;server= AURORA-SERVER;");
con.Open();
String sql = "select * from Specialty";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr1;
dr1 = cmd.ExecuteRead er();
//Speciality_Drop DownList.Items. Clear();
while (dr1.Read())
{
Specialty_DropD ownList.Items.A dd(dr1.GetValue (1).ToString()) ;
}
}}
But how can I bind both the column in the table by making 1 column hidden. That is making the specialty column binding based on specialty id.
Comment