T
Tumurbaatar S.
My page contains 2..3 DropDownList's with identical content.
For example, country names. Is there a way to bound these lists
to one data source? I think DataReader cannot act as shared source
due to its forward-only nature. But can I do as shown below?
SqlDataAdapter cmd = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
cmd.Fill(ds);
DataView dv = ds.Tables[0].DefaultView;
list1.DataSource = dv;
list1.DataBind();
list2.DataSource = dv;
list2.DataBind();
.....
Or is there any other shorter/simpler method?
For example, country names. Is there a way to bound these lists
to one data source? I think DataReader cannot act as shared source
due to its forward-only nature. But can I do as shown below?
SqlDataAdapter cmd = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
cmd.Fill(ds);
DataView dv = ds.Tables[0].DefaultView;
list1.DataSource = dv;
list1.DataBind();
list2.DataSource = dv;
list2.DataBind();
.....
Or is there any other shorter/simpler method?