PDA

View Full Version : Ajax tab not wired up correctly to webform



gotroots
05-22-2011, 08:17 PM
1) Script Title: Ajax Tabs Content Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem: I am getting this error when I run the webform:

Parser Error Message: Could not load type 'Main_Project.ExternalAjaxWebforms.external2'.

This is what I have on Line1 of the webform:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main_Project.ExternalAjaxWebforms.external2.aspx.cs" Inherits="Main_Project.ExternalAjaxWebforms.external2" %>

This is what the codebehind looks like:

namespace Main_Project.ExternalAjaxWebforms
{
public partial class external2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
}

This is what the external2.aspx looks like:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="external2.aspx.cs" Inherits="Main_Project.ExternalAjaxWebforms.external2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
This is the contents of "external2.htm"<br />
This is the contents of "external2.htm"<br />
This is the contents of "external2.htm"<br />
</div>
</form>
</body>
</html>

Here is Line1 of the masterpage

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MainMasterPage.master.cs" Inherits="Master_pages_MainMasterPage" %>

Here is the webform that is linked to the masterpage

<%@ Page Title="" Language="C#" MasterPageFile="~/Master_pages/SecondLevel.master" AutoEventWireup="true" CodeBehind="GBResultsPage.aspx.cs" Inherits="Main_Project.GBond.GBResultsPage" %>

Very grateful for any advice.

gotroots
05-23-2011, 08:56 AM
Following further testing I am now able to return the content of each tab without any errors.

The only problem now is that the content of each tab does not display in the tab control itself but on a seperate webpage. Anyone got an idea what I need to do.

gotroots
05-23-2011, 04:39 PM
I have fixed this bug. The script

var countries = new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()
should have been wrapped around

jQuery().ready(function () {}); in the .js file

traq
05-23-2011, 05:34 PM
if that's all the problem was, you could also simply place that script at the very bottom of your html page (just before </body>). that way, you know the document is ready before your scripts execute.

gotroots
05-23-2011, 09:16 PM
Your right, only there will be other webpages that will contain a tab control. I tend to place all scripts in a central .js file for easy maintenance.