Multiple DataTextField In Dropdownlist in Asp.Net C#
- DataTable dt = ds.Tables[0];
- if (dt.Rows.Count > 0)
- {
- Dictionary<int, string> lst = new Dictionary<int, string>();
- foreach (DataRow row in dt.Rows)
- {
- //Add values to Dictionary
- string val = row[1].ToString() + " " + row[2].ToString() + " - " + row[3].ToString();
- lst.Add(Convert.ToInt32(row[0]), val);
- }
- dllVendorName.DataSource = lst;
- dllVendorName.DataTextField = "Value";
- dllVendorName.DataValueField = "Key";
- dllVendorName.DataBind();
- }
Example:

Good Job Mr. Mehul Sir
ReplyDeleteCan you please send me query about return type using same method name and same number of variables and same variable....?
my mail id is vickyduvey733@gmail.com