|
DataSet - Tables problem! -- Garrold --
Hi, I'm having trouble with my callback method. The method receives a DataSet and uses the table within it to populate a drop down list, however I'm getting a "Tables is null or not an object" javascript error. This is the callback method: function vehiclemakeindexchanged_callback(response) { var modelDDL = document.getElementById('vmDDL'); removeAllDDLOptions(modelDDL, false); modelDDL.options = new Option('Please select', '0', false, false); var models = response.value; for (var i = 0; i < models.Tables .Rows.length; i++) { modelDDL.options , models.Tables , false, false); } } I've used the following code to register the dataset type in the OnInit event of my control: AjaxPro.Utility.RegisterTypeForAjax(typeof(DataSet)); Many thanks in advance! |
|
-- JosephGuadagno --
You are supposed to use AjaxPro.Utilitiy.RegisterTypeForAjax(typeof(<classname>)); for registering the class. There is no need to register the DataSet type. I would check the ASP.NET method that you are calling to make sure it is returning a DataSet and not a DataTable. Joseph Guadagno http://josephguadagno.net |
|
-- INeedADip --
Well, first look at the Fiddler to see what is being returned... Then depending on what version you are using...at one point you had to register the DataSet and DataTable Converters.... |
|
-- Garrold --
Sorry, should have included the other register type command AjaxPro.Utility.RegisterTypeForAjax(typeof(VehicleDetails)); AjaxPro.Utility.RegisterTypeForAjax(typeof(DataSet)); Also, the ajax method is returning a dataset, it is working fine on my local environment but not on our live test server, here is the code for the ajax method: public DataSet VehicleMakeSelectedIndexChanged(int vehicleMakeId) { DataSet ds = new DataSet(); DataTable dt = new DataTable("VehicleModels"); if (vehicleMakeId > 0) { _dal = new VehicleDetailsDAL(_channelId); dt = _dal.GetVehicleModelsByMakeId(vehicleMakeId); _dal = null; } ds.Tables.Add(dt); return ds; } |
|
-- INeedADip --
_dal and _channelId....are those private variables? I ask because I don't see a declaration, and I don't think you have access to those variables I could definatelly be wrong, I've never tried. But I know there is no page lifecycle... I'm just throwing some ideas out. If it's working on your dev machine then it is probably not your code. Time to look at the differences in configuration and what not in your test environment.. |