开发者

How to popluat value form database into combo box using Asp.net

I want to fetch list of students into combo bo开发者_开发百科x and on the base of combo box slection I will fetch their related record into another grid. please guide me regarding this task.


You can bind DropDownList as below

DropDownList1.DataSource=GetStudentDataSet();
DropDownList1.DataTextField="StudentName";
DropDownList1.DataValueField="StudentID";
DropDownList1.DataBind();

Put GridView bind code on selected change event of DropDownList as below

void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //Fecth selected student id 
         int studentId = Convert.ToInt32(DropDownList1.SelectedValue);
        //Bind Grdivew
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜