• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Problem with Visual Studio 2005 migration

I have a page which used to work in Visual Studio 2003 but now it doesn't. The code that seems to have the problem is:

<table class="leftSideBoxC" cellspacing="0" cellpadding="0" width="100%" border="0">

      <%for (int i=0;i+1<=sub_categories.Count;i++)         { //Here starts the loop for types categories %>

      <%if (((ArrayList)((ArrayList)sub_categories[i])[0])[0].Equals(rootCategory)) {%>

      <tr>

            <td class="categories" align="left" valign="middle"><%=((ArrayList)((ArrayList)sub_categories[i])[0])[1]%></td>

      </tr>

      <%} else {%>

      <tr>

            <td class="categories" align="left" valign="middle"><a href="<%=Session["SiteUrl"].ToString()+"/"+FrameWork.Constants.getUrlFriendly(((ArrayList)((ArrayList)sub_categories[i])[0])[1])%>/category.aspx?id=<%=((ArrayList)((ArrayList)sub_categories[i])[0])[0]%>"><%=((ArrayList)((ArrayList)sub_categories[i])[0])[1]%></a></td>

      </tr>

      <%}%>

      <%if (((ArrayList)((ArrayList)sub_categories[i])[0])[0].Equals(rootCategory)) {%>

      <%for (int k=1;k+1<=((ArrayList)sub_categories[i]).Count;k++)           { //Here starts the loop for types categories %>                

      <tr>

            <td class="sub_categories" align="left">

                  <a href="<%=Session["SiteUrl"].ToString()+"/"+FrameWork.Constants.getUrlFriendly(((ArrayList)((ArrayList)sub_categories[i])[0])[1])+"/"+FrameWork.Constants.getUrlFriendly(((ArrayList)((ArrayList)sub_categories[i])[k])[1])%>/category.aspx?id=<%=((ArrayList)((ArrayList)sub_categories[i])[k])[0]%>">

                        <%=((ArrayList)((ArrayList)sub_categories[i])[k])[1]%>

                  </a>                    

            </td>

      </tr>

      <%}%>

      <%}%>

      <%}%>

</table>

Moreover, the problem is that whenever the page loads it does not continue to Page_Load if I have this code. It's so strange...

Any ideas would be highly appreciated.

Thanks!!
John
0
infodigger
Asked:
infodigger
  • 2
  • 2
1 Solution
 
dstanley9Commented:
Are you getting errors or does it just not behave as expected?
0
 
infodiggerAuthor Commented:
It's hard to say. Because with the file I am posting here I am getting an error which says that this line is incorrect:

Line 36:       <%if (((ArrayList)((ArrayList)sub_categories[i])[0])[0].Equals(rootCategory)) {%>

because rootcategory does not exist in current context. However, it exists but somehow the code is not loaded. The acsx page I am posting inherits another cs page and also have a codebehind property to another page.

I had almost the same problem with another page and I fixed it by making AutoEventWireup="True" instead of False.
0
 
infodiggerAuthor Commented:
Just to add something to the previous example.

This is the first line of the ascx page:

<%@ Control Language="c#" AutoEventWireup="True" Codebehind="leftbarCategoriesB.ascx.cs" Inherits="FrameWork.components.leftbarCategories"  targetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

When you add a breakpoint at the Page_Load seciton of the leftbarCategoriesB.ascx.cs file it does not get hit.



0
 
dstanley9Commented:
It seems like the Page_Load is not being wired up automatically.  That is what AutoEventWireup="True" does.  If it's not wired up, any varaibles declared in Page_Load will not be available in your inline script.

You can try AutoEventWireup="False" and wiring up any events manually in the constructor:

this.Load += new System.EventHandler(this.Page_Load);
//etc.

BTW, this is the default for VS 2003. I believe that VS2002 used AutoEventWireup="True" by default.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now