|
|
| View previous topic :: View next topic |
| Message |
|
Author
|
Garrold
Newbie
|
Joined: 25 Jul 2006
Posts: 10
|
|
Posted: Wed Jul 26, 2006 4:00 am
Post subject: DataSet - Tables problem! |
|
|
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[0] = new Option('Please select', '0', false, false);
var models = response.value;
for (var i = 0; i < models.Tables[0].Rows.length; i++)
{
modelDDL.options[modelDDL.options.length] = new Option(models.Tables[0].Rows[i]["ModelDescription"],
models.Tables[0].Rows[i]["ModelDescription"], 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!
|
| Back to top |
|
 |
|
Author
|
JosephGuadagno
Newbie
|
Joined: 11 Jul 2006
Posts: 49
|
|
Posted: Wed Jul 26, 2006 4:00 am
Post subject: |
|
|
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
|
| Back to top |
|
 |
|
Author
|
INeedADip
Newbie
|
Joined: 11 Jul 2006
Posts: 36
|
|
Posted: Wed Jul 26, 2006 4:00 am
Post subject: |
|
|
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....
|
| Back to top |
|
 |
|
Author
|
Garrold
Newbie
|
Joined: 25 Jul 2006
Posts: 10
|
|
Posted: Thu Jul 27, 2006 4:00 am
Post subject: |
|
|
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:
[AjaxPro.AjaxMethod]
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;
}
|
| Back to top |
|
 |
|
Author
|
INeedADip
Newbie
|
Joined: 11 Jul 2006
Posts: 36
|
|
Posted: Thu Jul 27, 2006 4:00 am
Post subject: |
|
|
_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..
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|