| | |
Ajax Question
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
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
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.
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 2:07 am.
![]() |
Similar Threads
- Question - ASP + Ajax (ASP)
- Levyo Ajax Technology Gallery (JavaScript / DHTML / AJAX)
- AJAX : Am i right with the concept? (JavaScript / DHTML / AJAX)
- AJAX techniques... (JavaScript / DHTML / AJAX)
- AJAX in Apache? (Linux Servers and Apache)
- Changing Network Configuration (*nix Software)
Other Threads in the ASP.NET Forum
- Previous Thread: Refresh Parent Browser
- Next Thread: painting
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class compatible confirmationcodegeneration content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv forms gridview gudi homeedition iis javascript jquery list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xml xsl





