I'm trying to create a dynamic module where I drop an object on screen. Then a jQuery dialog opens with three drop-down lists. When I select a value in the first drop-down list I'm trying to filter the results in the next list via Ajax.
This is my JS code:
$("#ddlTableType").live(
'change',
function()
{
var GetTablesCodes = $.ajax({
url:'AjaxActions/TableCodes.aspx?ObjectType=' + $("#ddlTableType").val(),
async:false
}).responseText;
//alert(GetTablesCodes);
//alert(GetTablesCodes.$('#hidCodesList').val());
//alert($('#hidCodesList').val());
}
);
In the ASP.NET page I'm doing the following:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TableCodes.aspx.cs" Inherits="AjaxActions_TableCodes" %>
<form id="form1" runat="server">
<asp:HiddenField ID="hidCodesList" runat="server" />
</form>
The code behind for this page:
public partial class AjaxActions_TableCodes : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet dsCodesList = DbHelper.ExecuteDataSet(
ConfigurationManager.AppSettings["ConnStr"],
"spObjectCodesByTYpe_Select",
new SqlParameter("@ObjectType", Request.QueryString["ObjectType"])
);
hidCodesList.Value = "";
for(Int16 CodeListIndex=0;CodeListIndex<dsCodesList.Tables[0].Rows.Count;CodeListIndex++)
{
hidCodesList.Value += dsCodesList.Tables[0].Rows[CodeListIndex]["Value"].ToString() + ",";
}
}
}
In my first call to alert I get the entire page. In that I can see the hidden field filled with the data I need. How can i extract this data? Finally, all the drop-down lists are in a JDialog so maybe that is causing an issue.