Hi all,
I'm new to AJAX, I'm using 1.1 framework version. My problem is that I
want to fill a DropDownList from a DataTable that I create server-side
(it also doesn't work with DataSet). But I get this error from the
JavaScript:
'Rows' is null or not an object
I did an alert on res.value and its null so I'm getting just a null
value from the server. I'm stuck.
Here's my code:
Server:
<AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)> Public
Function LoadOffices(ByVal component As String) As DataTable
Dim cmdSac As New SqlClient.SqlCommand("select SAC from
COMPONENT where Component = '" & component & "'", cnPCIS)
OpenDB("COOP")
Dim sac As String = CStr(cmdSac.ExecuteScalar())
Dim cmdOffice As New SqlClient.SqlCommand("select SHORT_ENG
from OFFICE where SAC_CODE like '" & sac & "%'", cnPCIS)
Dim daOffice As New SqlClient.SqlDataAdapter(cmdOffice)
Dim dsOffice As New DataSet
daOffice.Fill(dsOffice)
cnPCIS.Close()
Return dsOffice.Tables(0)
End Function
Client-side:
function loadoffices(e) {
COOP.search.LoadOffices(e,
loadoffices_callback);
}
function loadoffices_callback(res) {
var dd = document.getElementById("ddOffice");
dd.options.length = 0;
//alert(res.value);
var ds = res.value; //datatable
dd.options[0] = new Option();
for (var i = 0; i < ds.Rows.length; i++)
dd.options[i+1] = new
Option(ds.Rows[i].SHORT_ENG);
}
on the DropDownList I have:
onchange="javascript:loadoffices(this.value);void(0);"
I have another working dorpdown but it returns an array instead of a
datatable.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---