|
using AjaxPro.dll for postback on ddl to change selected index on another ddl -- bubberz --
Eric, I have this for the ddl SelectedIndexChange event: <AjaxPro.AjaxMethod()> Private Sub KSddlNewName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KSddlNewName.SelectedIndexChanged divZNumber.InnerHtml = KSddlNewName.SelectedValue.ToString() 'Build SQL String to pull the associated Code, and default the second ddl selected item Dim strSQLNNV As String = "usp_SAResKSddlSelectedIndexChanged" Dim sCon1 As New SqlConnection sCon1.ConnectionString = Session("DBDDL") Try sCon1.Open() Dim cmdNNV As New SqlCommand(strSQLNNV, sCon1) cmdNNV.CommandType = CommandType.StoredProcedure cmdNNV.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ZNumber", System.Data.SqlDbType.NVarChar, 50)) cmdNNV.Parameters("@ZNumber").Value = divZNumber.InnerHtml Dim myNNVRDR As SqlDataReader = cmdNNV.ExecuteReader(CommandBehavior.CloseConnection) myNNVRDR.Read() Dim strNNVRDRResCode As String = myNNVRDR("Resource Code") KSddlNewP3ResourceCode.SelectedValue = strNNVRDRResCode.ToString() myNNVRDR.Close() myNNVRDR = Nothing sCon1.Close() Catch ex As Exception lblStatus.Text = "* Un-matched Resource Code in Resource Table: contact, wpg-help * " & ex.Message Finally sCon1.Close() End Try End Sub In the page_Load, I have: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(CreateNewResource)) If Page.ispostback.... End Sub In web.config: <httpHandlers> <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/> </httpHandlers> </system.web> I did set the first ddl AutoPostBack to false. Sorry, but I'm not following what else should be done. I thought with putting the AjaxMethod declaration for the SelectedIndexChange of the first ddl, that the second would then change based on the first ddl selection id. I'm sure you can probably see why, but now I'm not sure why the code isn't chaning the 2nd ddl. Thanks! |