| Sender |
Anuraj
|
| Recipient(s) |
Spha
|
| Date |
02 Oct 2009
|
Re: Re: Re: Re: How to bind a dropdown inside gridview c#
|
Check this code
private DataTable GetSemesters() { return new DataTable(); } private string GetCurrentSem(int courseCode) { return string.Empty; } protected void grdApproved_RowDataBound(object sender, GridViewRowEventArgs e) { DropDownList ddl = e.Row.Cells[2].FindControl("ddlSemester") as DropDownList; Label lblCourseCode = e.Row.Cells[0].FindControl("lblCourseCode") as Label; ddl.DataSource = this.GetSemesters(); ddl.DataTextField = "SemId"; ddl.DataTextField = "SemText"; ddl.DataBind(); ddl.Items.FindByValue(GetCurrentSem(int.Parse(lblCourseCode.Text))).Selected = true; }
|