Hi ,
Check this
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["testConnectionString"].ConnectionString))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("select * from test1", con))
{
DataTable dt = new DataTable();
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
adpt.Fill(dt);
Dictionary<int,string> lst = new Dictionary<int,string>();
foreach (DataRow row in dt.Rows)
{
string val = row[1].ToString() + " , " + row[2].ToString() + " , " + row[3].ToString();
lst.Add(Convert.ToInt32(row[0]), val);
}
DropDownList1.DataSource = lst;
DropDownList1.DataTextField = "Value";
DropDownList1.DataValueField = "Key";
DropDownList1.DataBind();
}
}
}
}
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
Best Regards
M.Mitwalli