Bueno ya lo consegi, coloque otro label donde esta el label que me muestra la descripcion del pais otro en el esta la descripcion de region y otro para cliente
todas
Visible=False, osea area del
Item Template del
GV
p r c son los label que fueron creados
estas ppai y regg son variables
luego en el
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim controlx As String
Dim pai As Label = DirectCast(GridView1.Rows(e.NewEditIndex).FindCont rol("p"), Label)
Dim reg As Label = DirectCast(GridView1.Rows(e.NewEditIndex).FindCont rol("r"), Label)
Dim cli As Label = DirectCast(GridView1.Rows(e.NewEditIndex).FindCont rol("c"), Label)
controlx = "ddlpais"
GridView1.EditIndex = e.NewEditIndex
FillCustomerInGrid()
BindGridDropDownList(e.NewEditIndex, pai, controlx)
controlx = "ddlregion"
GridView1.EditIndex = e.NewEditIndex
BindGridDropDownList(e.NewEditIndex, reg, controlx)
controlx = "ddlclte"
GridView1.EditIndex = e.NewEditIndex
BindGridDropDownList(e.NewEditIndex, cli, controlx)
End Sub
Protected Sub BindGridDropDownList(ByVal iEditIndex As Integer, ByVal lblpai As Label, ByVal contro As String)
If contro = "ddlpais" Then
Dim cmbType As DropDownList = DirectCast(GridView1.Rows(iEditIndex).FindControl( contro), DropDownList)
cmbType.DataSource = customer.Fetchpais()
cmbType.DataBind()
cmbType.Items.FindByValue(lblpai.Text).Selected = True
ppai = lblpai.Text
Else
If contro = "ddlregion" Then
Dim cmbType1 As DropDownList = DirectCast(GridView1.Rows(iEditIndex).FindControl( contro), DropDownList)
cmbType1.DataSource = customer.Fetchregion(ppai)
cmbType1.DataBind()
cmbType1.Items.FindByValue(lblpai.Text).Selected = True
regg = lblpai.Text
Else
Dim cmbType2 As DropDownList = DirectCast(GridView1.Rows(iEditIndex).FindControl( contro), DropDownList)
cmbType2.DataSource = customer.Fetchclte(ppai, regg)
cmbType2.DataBind()
cmbType2.Items.FindByValue(lblpai.Text).Selected = True
End If
End If
End Sub
Public Function Fetchpais() As DataTable
Dim sql As String = "SELECT descripcion,codpais FROM pais"
Dim da As New OleDbDataAdapter(sql, cnstr)
Dim dt As New DataTable()
da.Fill(dt)
Return dt
End Function
Public Function Fetchregion(ByVal varpais As String) As DataTable
Dim sql As String = "SELECT * FROM region where pais = '" & varpais & "'"
Dim da As New OleDbDataAdapter(sql, cnstr)
Dim dt As New DataTable()
da.Fill(dt)
Return dt
End Function
Public Function Fetchclte(ByVal varpais As String, ByVal varregion As String) As DataTable
Dim sql As String = "SELECT * FROM CLIENTE where codpais = '" & varpais & "' AND codregion = '" & varregion & "'"
Dim da As New OleDbDataAdapter(sql, cnstr)
Dim dt As New DataTable()
da.Fill(dt)
Return dt
End Function
y listo osea 3 DDL dentro de un GV y cada DDL se llena dependiento del anterior DDL
buena suerte