hi guys, I am using following code in rowdatabound fn.
Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Footer Then
Dim ddlItem As DropDownList = CType(e.Row.FindControl("ddlFProjectLevels"), DropDownList)
If ddlItem IsNot Nothing Then
ddlItem.DataSource = objMileStone.GetProjectLevels()
ddlItem.DataValueField = "MileStoneID"
ddlItem.DataTextField = "Name"
ddlItem.DataBind()
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowState = DataControlRowState.Edit Then
Dim ddlEProjectLevels As DropDownList = CType(e.Row.FindControl("ddlEProjectLevels"), DropDownList)
ddlEProjectLevels.DataSource = objMileStone.GetProjectLevels()
ddlEProjectLevels.DataValueField = "MileStoneID"
ddlEProjectLevels.DataTextField = "Name"
ddlEProjectLevels.DataBind()
ddlEProjectLevels.SelectedValue = milestoneid
End If
End If
End Sub
ddlEProjectLevels is dropdownlist in edititemtemplate.Whwn i click edit in 1st row ddlEProjectLevels gets loaded with data from database.But in 2nd row dropdownlist does not contain values.Again in 3rd it gets loaded from db.Means in alternate rows,when i click edit dropdownlist(ddlEProjectLevels) doesnot load values.Can anybody help?