Note that there are some explanatory texts on larger screens.

plurals
  1. POInteraction of Web User Controls and Structure (Having conceptual difficulties)
    primarykey
    data
    text
    <p>In my asp .net C# project I have a page defualt.aspx on which I have placed 2 components. So in all I have:</p> <pre><code>1) default.aspx (main page, not doing much code in it) 2) wuc_Lookup.ascx (doing a lot here, grabbing data, setting session, etc) 3) wuc_PageMessages.ascx (has a couple of panels and labels for message output </code></pre> <p>)</p> <p>The intent is to use 3) in any page in my application. 1) and 2) are already working. My issue is that the Page_Load sequence is:</p> <p>1st default Loads 2nd wuc_pageMessage loads 3rd wuc_lookup loads</p> <p>The problem with this is that The wuc_pageMessage is relevant only <strong><em>after</em></strong> wuc_lookup runs.</p> <p>My intent was not to put code in Page_Load for the message wuc_pageMessage control because I wanted to be able to call a method to post the message during the component load of wuc_lookup. I do this because only after wuc_lookup do I set the session which I use for the message value.</p> <p>I actually got values showing up if I put the code in wuc_lookup to manipulate the code-in-front server control (panels and labels) using this.parent.findControl syntax...</p> <p>But then when I try to rip that code and put it into the code-behind for wuc_pageMessage, and then call the method from the wuc_lookup it has fallen out of scope or context...</p> <p>So I tried to change this.Parent by passing httpContext.current.handler as casting it as page...that didn't work...then I tried passing Object sender from the calling component...that didn't work either. Neither of them had the Parent property and or it was null which led me to believe that once the wuc_PageMessages.ascx loaded it was a dead deal until a repost happens and that is ugly and something I don't want to do.</p> <p>I am having some implementation issues and I am not sure what to do. I have been stunk on this for eight hours and Is there just something I am not seeing?</p> <p>I want to keep away from spagetti code. I don't want to have to scatter code-behind in 3 different files. Theoretically I should only need 2 of these to talk to eachother. i don't want code-behind in default..it's basically just a container. I want to trigger the wuc_pageMessage from wuc_Lookup.ascx without having it be "in" wuc_Lookup.ascx (peer web user controls) I want that to always be a peer relationship. Any advice would be great ...thanks...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload