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.
<%@ 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>
This the actual page which use some master page along with this page.
And follwing is the server side code
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
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