Tengo 3 DDL , están el cascada (CascadingDropDown) Ajax, están funcionando bien, pero como hago para que me funcione el SelectedIndexChanged, de colocarla AutopostBack=True esto genera un error.
Necesito saber que selecciona el usuario para luego colocar invisible unos TEXTBOXS
Alguien sabe o tiene una idea como solucionar esto.???
Aquí el código
HTML
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<br /><br />
<table border="0">
<tr>
<td align="right" style="width: 122px; height: 24px;">Car:</td>
<td style="width: 10px; height: 24px;"></td>
<td align="left" style="width: 128px; height: 24px;">
<asp:DropDownList ID="ddlMakes" runat="server" Width="240px" />
</td>
</tr>
<tr>
<td align="right" style="width: 122px">Model:</td>
<td style="width: 10px"></td>
<td align="left" style="width: 128px">
<asp:DropDownList ID="ddlModels"
runat="server" Width="240px"
DataTextField="descripcion"
DataValueField="region" />
</td>
</tr>
<tr>
<td align="right" style="width: 122px">Color:</td>
<td style="width: 10px"></td>
<td align="left" style="width: 128px">
<asp:DropDownList ID="ddlColors" runat="server" Width="240px" />
</td>
</tr>
</table>
<ajaxToolkit:CascadingDropDown ID="cddMakes"
runat="server"
TargetControlID="ddlMakes"
Category="pais"
PromptText="Select...."
LoadingText="Please wait ..."
ServicePath="WebService.asmx"
ServiceMethod="GetMakes">
</ajaxToolkit:CascadingDropDown>
<ajaxToolkit:CascadingDropDown ID="cddModels"
runat="server"
TargetControlID="ddlModels"
ParentControlID="ddlMakes"
Category="region"
PromptText="Select...."
LoadingText="Please wait ..."
ServicePath="WebService.asmx"
ServiceMethod="GetModels">
</ajaxToolkit:CascadingDropDown>
<ajaxToolkit:CascadingDropDown ID="cddColors"
runat="server"
TargetControlID="ddlColors"
ParentControlID="ddlModels"
Category="Clte"
PromptText="Select...."
LoadingText="Please wait ..."
ServicePath="WebService.asmx"
ServiceMethod="GetColors">
</ajaxToolkit:CascadingDropDown>
</form>
Codigo VB.Net
Public Function GetMakes(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim sqlConn As New SqlConnection(conString)
sqlConn.Open()
Dim sqlSelect As New SqlCommand("SELECT * FROM pais", sqlConn)
sqlSelect.CommandType = System.Data.CommandType.Text
Dim sqlAdapter As New SqlDataAdapter(sqlSelect)
Dim myDataset As New DataSet()
sqlAdapter.Fill(myDataset)
sqlConn.Close()
Dim cascadingValues As New List(Of CascadingDropDownNameValue)()
For Each dRow As DataRow In myDataset.Tables(0).Rows
Dim categoryID As String = dRow("codpais").ToString()
Dim categoryName As String = dRow("descripcionpais").ToString()
cascadingValues.Add(New AjaxControlToolkit.CascadingDropDownNameValue(cate goryName, categoryID))
Next
Return cascadingValues.ToArray()
End Function
<WebMethod()> _
Public Function GetModels(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(k nownCategoryValues)
Dim codpais As String = kv("pais")
Dim sqlConn As New SqlConnection(conString)
sqlConn.Open()
Dim sqlSelect As New SqlCommand("SELECT * FROM region where pais = @copais", sqlConn)
sqlSelect.CommandType = System.Data.CommandType.Text
sqlSelect.Parameters.Add("@copais", SqlDbType.NVarChar).Value = codpais
Dim sqlAdapter As New SqlDataAdapter(sqlSelect)
Dim myDataset As New DataSet()
sqlAdapter.Fill(myDataset)
sqlConn.Close()
Dim cascadingValues As New List(Of CascadingDropDownNameValue)()
For Each dRow As DataRow In myDataset.Tables(0).Rows
Dim productID As String = dRow("region").ToString()
Dim productName As String = dRow("descripcion").ToString()
cascadingValues.Add(New AjaxControlToolkit.CascadingDropDownNameValue(prod uctName, productID))
Next
Return cascadingValues.ToArray()
End Function
<WebMethod()> _
Public Function GetColors(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(k nownCategoryValues)
Dim codpais As String = kv("pais")
Dim codregion As String = kv("region")
Dim sqlConn As New SqlConnection(conString)
sqlConn.Open()
Dim sqlSelect As New SqlCommand("SELECT * FROM cliente where codregion = @region AND codpaisclte = @pais", sqlConn)
sqlSelect.CommandType = System.Data.CommandType.Text
sqlSelect.Parameters.Add("@pais", SqlDbType.NVarChar).Value = codpais
sqlSelect.Parameters.Add("@region", SqlDbType.NVarChar).Value = codregion
Dim sqlAdapter As New SqlDataAdapter(sqlSelect)
Dim myDataset As New DataSet()
sqlAdapter.Fill(myDataset)
sqlConn.Close()
Dim cascadingValues As New List(Of AjaxControlToolkit.CascadingDropDownNameValue)()
For Each dRow As DataRow In myDataset.Tables(0).Rows
Dim productID As String = dRow("codclte").ToString()
Dim productName As String = dRow("nombre").ToString()
cascadingValues.Add(New AjaxControlToolkit.CascadingDropDownNameValue(prod uctName, productID))
Next
Return cascadingValues.ToArray()
End Function
Gracias