Load multiple flex modules in one application - apache-flex

I come from ASP.NET and I am learning Flex now. I don't know if I can do what I want in flex, so imagine this in ASP: I have an aspx page that loads a Login.ascx control, the control checks if login is correct, and if so the aspx page loads the XXX.ascx control (so there is only one control visible).
I want to do more or less the same in Flex: I have the main application with the code that connects to the database, check the login, and if its correct it loads a new module. I have made everything until the module load, I mean, I have the main application (Login.mxml) associated to a Login.as, and a Module.mxml associated to a Module.as. When the user press the login button (in Login.mxml), a method is fired and checks the login. If it is correct, it shows the new module.
My problem is that it is shown in the same page that the login page, instead of "changing" the page. I have used two ways to do that: ModuleLoader and PopUpManager, and both load the new module in the same page.
QUESTION: How can I load, inside an application, a Flex module in a different page?

If you want to build Applications, I strongly suggest you get out of the page mindset. Excel doesn't have the concept of pages in it's UI as one example. You wouldn't have links tot he formula editor or whatnot.
But, that said you should probably investigate the BrowserManager and how to Deep Link into a flex Application. Then you can change the URL in the browser's address bar when your application view change.
If your adamant about applying the page paradigm to application building
You could also use the navigatetoURL to redirect to a different page which would load a new flex applications.

Related

asp.net bypass dynamically loaded page to get to target

background:
existing asp.net web application employs a number of dynamically-loaded user
controls and pages
many of these pages and user controls depend on parent page context
a new project containing “version 2” of the application needs to integrate with aforementioned legacy version in production while “version 2” continues to be developed
scenario:
I’m using a response.redirect with a parameterized URL to navigate from “version 2” page back to a dynamically-loaded legacy page - a "page 1", if you will. This works fine. However, the ultimate goal/target is to navigate directly to a dynamically-loaded legacy page which is “2 clicks away” from the initial target. The “clicks” would be from the dynamically-rendered controls.
question:
Is it possible from my “version 2” page in the code-behind to navigate directly to this ultimate target? When I call the user click procedures in code immediately following the call stack from the initial redirect, it still lands me on legacy page 1.
So the basic question is more conceptual in terms of handling direct navigation several “hops” into dynamically-loaded pages. In other words, can navigation be controlled in code-behind from dynamic controls without actually rendering them back to the client onscreen?
Much obliged for any help to get me beyond this impasse.
/John
The crux of the issue was how to reach a dynamically generated target page from a point in the application which required multiple click events (i.e. multiple round trips), and reduce that to a single round-trip in the code-behind.
Invoking consecutive click events in the code-behind without rendering would have been a recursive violation of the page life-cycle.
Essentially, sequential click events cannot be leveraged in 1 round trip - the solution is to leverage the relevant underlying procedure calls, and/or write new ones in order to yield the target page.

Master page oddity on server deployment

I have inherited a solution created in ASP.net with VB.net and am having a real problem with the error message "Content controls have to be top-level controls in a content page or a nested master page that references a master page."
The design is somewhat complex as follows:
The app uses a single Masterpage. The child page accessed has a custom user control on it. The user control contains, amongst other controls, an iframe. The source of the iframe is set programatically to another page, (aspx) which does not inherit from the Masterpage as we don't want the headers, footers etc. to appear in the iframe.
This aspx page has another custom user control on it that displays a small number of controls, buttons, text fields, file upload etc.)
This all works well in my IDE (Visual Studio 2005) and the file upload control is displayed properly. As soon as it's deployed to a server, (test or live) I get the error message at the beginning of this post.
The pages and code are too complex to post here but if I haven't given enough detail I will try to explain as necessary. I hope someone can help as this has been driving me insane. I've searched extensively with no success.
Many thanks.

ASP.NET background loading process

I'm working on an ASP.NET web site using VS2008, C#, I want my news pages to be displayed after being fully loaded, i.e. when user clicks on a link, my page loads (in the background?) and after the loading process has been fully performed the new contents get displayed on page, so that no flickering or empty page occurs, meanwhile I want to display a loading graphic on the page, what are my options? is it possible at all? I'm using a master page in my project
thanks

Architectural decisions about popups in web (.NET Vision)

I've always wanted to know what is, in a general way, the opinions about popups in web (I mean, those who are implemented via divs).
I've always liked not to load the user with the entire size of this popup in his navegation (when the popup is not visible). I assume that it's better load the content by demand (when the user clicks in the corresponding button). If you have five popups in one page, I always thought that the increase in 'bytes' can make a difference downloading the page.
Following the 'on demand' option I've always liked iframes because they let me change his URL via Javascript. So, I display a popup (div) which contains an iframe in wich I can change his contents downloading the page in this moment.
In my probably limited view, this method has another advantage. The validation logic (usually Asp.NET validators) are isolated in the popup page, so they don't enter in any kind of conflict with the validators located in the parent page (if applicable).
But it seems that iframes are not so well supported by some browsers and they are not too much appreciated by the community of designers (and it's a object with strong security implications).
So Basically I was wondering what are your experiences displaying these kind of UI. I know Jquery can load dynamically HTML in one div, but probably without isolating client validation scripting.
Opinions? THANKS a lot!
Firstly, you can create validation groups (http://msdn.microsoft.com/en-us/library/ms227424.aspx). That will help you with your validation problems.
You're right, you can use jQuery to dynamically load HTML as appropriate, but I'm not sure how well that works with aspx pages. There are problem a number of gotchas. Consider, you have page1.aspx and popup.aspx. If you load popup.aspx in an iFrame, you're fine, because it's a separate page. If you load it dynamically via JQuery.load() - the output of popup.aspx will load into your page1.aspx (this includes html tags, form tags, viewstate fields etc). That will likely cause some problems. (I haven't tried just guessing).
I have used .load in the past, but I tend to load standard html pages, not aspx pages. Then when the "submit" button is pressed, it calls a webservice with the relevent fields. This adds more javascript coding on my part - coding the "submit" button, coding a webservice to handle the ajax submit, coding the "wait screen" while an action is being done or data being submitted via ajax. I also have write the js to do client side validation and any code to handle server side validation and report that back to the user.
jQuery Validation plugins work well for this - or alternatively, you can instantiate .net validators if you don't want more plugins / frameworks (http://msdn.microsoft.com/en-us/library/yb52a4x0.aspx)

ASP.NET 2.0 -how do I include files containing server-side code?

I want to be able to load a customized log in page depending on a couple of parameters passed into the querystring.
Each customized login page needs to be able to dynamically display log in errors and possibly have other variables passed in.
Let's say the dynamic login page looks like this (over-simplification here):
<form>
<% if (has_errors) { Response.Write(error_msg); } %>
<input type="text" name="email">
</form>
If the aspx page loads the file like this:
Response.writefile("path/to/custom/page");
the code shows up in the output and doesn't get processed. I have tried other ways to load the file contents (something similar to classic ASP includes) but get the same results every time.
I could have all the custom pages set up as user controls, but I need 100% control over the css, js, and html - and the documentation I read here indicates that I won't have that level of granularity.
link text
PLUS - I'm stuck in a .net 2.0 environment - so .NET MVC is not available to me
Any help/suggestions?
but I need 100% control over the css,
js, and html
You won't get 100% over the page but you will have control inside the User Control instance. Also, many times, you can override these technologies like CSS, from within your control.
In the end because all controls are solified into one big HTML page you will have the same level of control as you would in any single web page with client-side technologies.
You can build a Web UserControl to represent log/in and then include an instance of that control onto any page, in any place, across multiple pages if you wish.
(See the Topics on that MSDN help page about how to create and use it).
Other useful references (these are various angles on the same subject).
Creating a Web user Control in .NET
ASP 101 - User Controls
This should provide a good start to keep looking, if this is the kind of info you think you need.
Internals
The User Control can have its own logic, access the browser querystring, access the page Session, Application, etc. pretty much anything it needs to know for itself to work.
Object Oriented
Additionally, because a User Control is also an object, you can add your own public methods and properties to it through which you can interact to communicate with the control intance on the page (just like you interact with other web controls like Button.Text="click", TextBox.BackColor = System.Drawing.Color.Blue, etc).
Other Options - Dynamic control loading
You might want to consider loading controls dynamically at runtime using the Page.LoadControl(..) method:
Loads a Control object from a file
based on a specified virtual path.
MyControl myControl1 = (MyControl)LoadControl("TempControl_Samples1.cs.ascx");
PlaceHolder1.Controls.Add(myControl1);

Resources