If e.Row.RowType = DataControlRowType.Header Then Dim ddlVCrop As New DropDownList ddlVCrop = CType(e.Row.FindControl("ddlCrop"), DropDownList) If Not ddlVCrop Is DBNull.Value Then Dim ds As New DataSet ds = objYield.getVariety If ds.Tables(0).Rows.Count > 0 Then ddlVCrop.DataSource = ds ddlVCrop.DataValueField = "VARIETY_CODE" ddlVCrop.DataTextField = "VARIETY_CODE" ddlVCrop.DataBind() ddlVCrop.Items.Insert(0, "Select One") End If
If ddlVCrop IsNot Nothing Then
Dim ds As DataSet = objYield.getVariety() If ds IsNot Nothing AndAlso ds.Tables.Count > 0 AndAlso ds.Tables(0).Rows.Count > 0 Then ... do your processing End If
GridView1.HeaderRow.FindControl("DropDownList1")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)