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 456,611 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 3,470 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

Ajax Question

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 3:40 pm.
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 7:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC