Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
WebDataTree always doing Default.aspx Page_Load even from other pages
posted

Summary:

When running from Visual Studio 2005 in debug mode. A page with a WebDataTree doing a NodePopulate event will always call the Default.aspx's Page_Load event (and that IsPostBack value of the Default.aspx page will be false).

Steps to reproduce the problem: 

I have supplied two forms - MyStartPage.aspx and Default.aspx.

In visual studio 2005, I put a break point on the line arbitrary line

  Label1.Text=DateTime.Now.ToString();

 in the Page_Load event (in the Default page), and when looking at MyStartPage, that line will always be executed.

 

A few other things tried: (but not in code below)

1) I've taken the ScriptManager off of the Default page, but no change.

2) I have even added a button to the MyStartPage. When it is pressed, I get the same result, but not if I take the WebDataTree off of the page.

3) On Default page, I set AutoEventWireup="false". Then manually wired the event within the Default classes constructor:

public _Default()

   {

      Load += new EventHandler(Page_Load);

   }

4) I have Changed the name of the class from _Default to _myDefault, but no change. (But if I change the filename from Default.aspx to something else, then it stops the problem)

Sample Code:

// --------------------------- MyStartPage.aspx

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyStartPage.aspx.cs" Inherits="MyStartPage" %>

 

<%@ Register Assembly="Infragistics2.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>

 

<!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>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

 <ig:WebDataTree ID="WebDataTree1" runat="server" Height="300px" Width="200px" OnNodePopulate="WebDataTree1_NodePopulate">

 </ig:WebDataTree>

    &nbsp;

</form>

</body>

</html>

 

 

// --------------------------- MyStartPage.aspx.cs

using System;

using Infragistics.Web.UI.NavigationControls;

 

public partial class MyStartPage : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!IsPostBack)

        {

            PopulateTheNode(WebDataTree1.Nodes);

        }

    }

 

    protected void WebDataTree1_NodePopulate(object sender, Infragistics.Web.UI.NavigationControls.DataTreeNodeEventArgs e)

    {

        PopulateTheNode(e.Node.Nodes);

    }

 

    public void PopulateTheNode(DataTreeNodeCollection nodes)

    {

        DataTreeNode ndNew = new DataTreeNode();

        ndNew.Text = "Root";

        ndNew.IsEmptyParent = true;

        nodes.Add(ndNew);

    }

}

 

 

// --------------------------- Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<%@ Register Assembly="Infragistics2.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

    Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>

 

<!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 id="Head1" runat="server">

    <title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

 <asp:ScriptManager ID="ScriptManager2" runat="server">

 </asp:ScriptManager>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    &nbsp;

</form>

</body>

</html>

// --------------------------- Default.aspx.cs

using System;

 

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!IsPostBack)

        {

            Label1.Text=DateTime.Now.ToString();

        }

    }

}

 

 

 

Parents Reply Children
No Data