开发者

dropdownlist binding

I was trying to bring all the database names in a dropdownlist.. Here is my code ..

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
populateddl();
}
}

private void populateddl()
{
using (SqlDataAdapter sda = new SqlDataAdapter("exec sp_databases", conn))
{
using(DataSet ds = new DataSet())
{
sda.Fill(ds);
DropDownList8.DataSource = ds;
DropDownList8.DataBind();
}
}
}

em not able to get the names in the dropdownlist, pls help me in this scenario.. when run the application what em gett开发者_运维知识库ing is.. system.data.datarowview as items of dropdownlist instead of this i should get names of databases Looking forward for ur replys

Thanks & Regards,


aslo specify the column name of the Datasource to be displayed

DropDownList8.DataTextField ="DataFieldName"
DropDownList8.DataValueField="DataFieldName"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜