FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister  MasterVB.NET
Visual Basic 2005 .NET Forum
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
DataSet - Tables problem!
 
Post new topic   Reply to topic    MasterVB.NET Forum Index -> ASP.NET General Discussion
View previous topic :: View next topic  
Message
Author
Garrold
Newbie
Joined: 25 Jul 2006
Posts: 10

PostPosted: Wed Jul 26, 2006 4:00 am    
Post subject: DataSet - Tables problem!
Reply with quote

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
View user's profile Send private message
Author
JosephGuadagno
Newbie
Joined: 11 Jul 2006
Posts: 49

PostPosted: Wed Jul 26, 2006 4:00 am    
Post subject:
Reply with quote

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
View user's profile Send private message
Author
INeedADip
Newbie
Joined: 11 Jul 2006
Posts: 36

PostPosted: Wed Jul 26, 2006 4:00 am    
Post subject:
Reply with quote

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
View user's profile Send private message
Author
Garrold
Newbie
Joined: 25 Jul 2006
Posts: 10

PostPosted: Thu Jul 27, 2006 4:00 am    
Post subject:
Reply with quote

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
View user's profile Send private message
Author
INeedADip
Newbie
Joined: 11 Jul 2006
Posts: 36

PostPosted: Thu Jul 27, 2006 4:00 am    
Post subject:
Reply with quote

_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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MasterVB.NET Forum Index -> ASP.NET General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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


Archieve

Powered by phpBB © 2001, 2002 phpBB Group, used in Visual Basic 2005 .NET Forum

| Visual Basic .NET Forum | Online Recipe Archiver | Shareware Freeware PAD | Lowongan Kerja | Kamus Online | Health Supply | Digital Camera Review |
Orang Paling Keren

RSS