User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,950 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,159 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1105 | Replies: 1
Reply
Join Date: Dec 2006
Posts: 232
Reputation: ssharish2005 is on a distinguished road 
Rep Power: 2
Solved Threads: 18
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Ajax Question

  #1  
Jan 21st, 2007
Hello guys,

Have a quite question anout Ajax. I am very new this topic,k so i dont much knowledge about this. Hope you can solve my problem. I was developing a web which use some ajax. But for some reason to wont call the server side script. I have tried the same thing with some simple example it works fine.

The problem which i am getting is here is the Object is undefined. But i have fillwed all the procedure. Here is my code.

[php]
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="MenuOpt" TagName="Menu" Src="~/MainHeader.ascx"%>
<%@ Register TagPrefix="Catopt" TagName="CatMenu" Src="~/CatagoryList.ascx"%>
<%@ Register TagPrefix="RightMenu" TagName="Menu" Src="~/RightMenuBar.ascx" %>
<%@ Register TagPrefix="BaseMenu" TagName="Menu" Src="~/BaseMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="menustyle.css" rel="stylesheet" type="text/css" />
<html>
<head runat="server">
<title>Untitled Page</title>
<script src="utilites.js" type="text/javascript" language="javascript"></script>
<script src="menuscript.js" type="text/javascript" language="javascript"></script>
<script src="SeverCodeCall.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" >
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<MenuOpt:Menu id="MainHeader" runat="server" />

</div>
<table align="center" border=0 style="width: 823px; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred;">
<tr>
<td align="left" style="width:47px ; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred; height: 22px; vertical-align: top;" >
<Catopt:CatMenu align="left" ID="Catagory" runat="server" />
</td>
<td style="width: 383px; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred; height: 22px; vertical-align: top; text-align: left;" >
<div id="MBodyDiv"></div>
</td>
<td align="right" style=" text-align:right; 186px; border-top-width: thin; border-left-width: thin; border-left-color: maroon; border-bottom-width: thin; border-bottom-color: maroon; border-top-color: maroon; border-right-width: thin; border-right-color: maroon; height: 22px; vertical-align: top;" >
<RightMenu:Menu align="right" ID="RightMenu" runat="server" />
</td>
</tr>
<tr>
<td colspan="3" style="border-top-width: thin; border-left-width: thin; border-left-color: maroon; border-bottom-width: thin; border-bottom-color: maroon; border-top-color: maroon; height: 19px; border-right-width: thin; border-right-color: maroon;">
<BaseMenu:Menu align="center" ID="BaseMenu" runat="server"/>
</td>
</tr>
</table>
</form>
</body>
</html>
[/php]

This the actual page which use some master page along with this page.
And follwing is the server side code

[php]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Ajax.Utility.RegisterTypeForAjax(GetType(_Default))
End Sub
<Ajax.AjaxMethod()> _
Public Function GetProductDes(ByVal ProdID As String) As String
Dim CatAdap As New CatagoryTableAdapters.CatagoryTableAdapter
Dim CatTable As Catagory.CatagoryDataTable
Dim ID As Integer = CInt(ProdID.Substring(11).ToString)
CatTable = CatAdap.GetDescription(ID)
If CatTable.Count > 0 Then
Return CatTable(0).Description.ToString
End If
Return Nothing
End Function
[/php]

when i call the GetProductDes function through _default object through javascript i give a runtime error _default undefined
Does anybody have any idea of why the object is the created.

Sorry about the long post.

Thanks guys.

ssharish2005
Last edited by ssharish2005 : Jan 21st, 2007 at 2:40 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Location: Japan
Posts: 70
Reputation: sedgey is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
sedgey sedgey is offline Offline
Junior Poster in Training

Re: Ajax Question

  #2  
Jan 22nd, 2007
looks like you are using the ajax.net library here, just a silly question, have you registered the http handler in the web.config file as per the instructions? Also there is a different method for registering user control classes for ajax handling. You can also check to see if the correct ajax functions are being added to the page again see the ajax.net site for examples of what you should be seeing at the top of the rendered page if the class has been registered correctly for ajax handling and for correctly registering a user control. The object not found is usually because the datatable is not being returned, so I would also check that your sql code is returning results and any variables you are sending are in fact being sent correctly. You can check to see that the ajaxmethod in your vb code is being called by putting a break point in it, that at least rules out a problem with the ajax library. while you do this you can check the variables and verify that a table (with rows) is indeed being created. The last check would be in your javascript code which handles the table when it's sent back remembering that its all case sensitive.
Last edited by sedgey : Jan 22nd, 2007 at 1:07 am.
sedgey: so little daylight, too much caffeine
MCSD MCAD MCSE
http://www.thefriendlybuilder.co.uk,
http://www.sheetmusicdirect.com
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 6:17 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC