Showing posts with label regular. Show all posts
Showing posts with label regular. Show all posts

Monday, March 26, 2012

Programming model question for Atlas apps

Hi,

I am designing a new web application and hope to leverage Atlas to make a better user experience than a regular ASP.NET web app. One of my things I hoping to archive to is to eliminate the need to have multiple ASPX pages.

Here is a scenario:

The web page may contain a left navigation panel that contains three links:

  1. Step 1
  2. Step 2
  3. Step 3

If I am to design a regular ASP.NET web app, I would make each of the links point to a separate ASPX page. Each of ASPX will share a common chrome such as header, top navigation panel and left navigation panel, but the main content area will be different. I would use a shared master page for them. The drawbacks of the traditional approach are:

  1. Opening each link will cause screen flickers
  2. There will be network delay from one step to another step that I can not reduce by preloading asynchronously.
  3. Each step will add to the browser history that my designer does not like.

I am hoping that Atlas will allow me to collapse all these ASPX pages into a single ASPX page, but I could not find a good approach. Specifically, I didn't find UpdatePanel useful for my design.

I am very interested to hear suggestions on how to archive my design objective. Thanks in advance.

Wei Zhu

hello.

well, you can use atlas to do this, though i really think that eliminating the history may not be a good thing. for instance, when i go to a web site, i really enjoy using the next and back buttons...and regarding to the delay, i really don't think that a normal asp.net page that has been modified to use atlas will be quicker that a traditional page.


Hi Luis,

Can you tell me how to use Atlas to achive my objective?

Regarding whether it is wise to eliminating IE history, I guess some people like it and some people don'tSmile [:)]. I personally don't have a strong opinion on either. As for the network delay, my thought is that using Atlas, maybe I can preload the UI for the step 2 asyncroulsy while user is still on step 1. However, reducing delay is more of an extra bonus credit, not a requirement.


Wei Zhu,

A simple approach to accomplish what I have interpreted your requirements is this:

Your left navigation could be setup as LinkButton controls.

You could put all 3 "pages" of content into a MultiView control.

On the postback of each LinkButton control, you could dynamically show and initialize all controls on the corresponding "View" of the MultiView control.

Surround all of these controls with an UpdatePanel and the result should be a page that appears to work completely clientside using the Atlas framework.

Hope this helps.

Ryan


Thanks Ryan.

I have considered using MultiView inside an UpdatePanel, but I think it will run into the following problems.

1. If I use Validators in each view, then switch view will cause a postback and the validators on those views that haven't been viewed will raise errors and prevent the postbacks from even happening.

2. This approach does not appear to be scale well as the number of views increase.


OK, I may have found a solution. The solution basically is to create a ASCX user control for each view, then load each user control dynamically using Page.LoadControl() inside a UpdatePanel. I did a quick test and it seems to work, although I still need to try it more.

This solution still does not address how to preload next view. It feel like possible to me, but I don't know exactly how to do it yet.


Have you considered using a Wizard control inside an update panel?

Saturday, March 24, 2012

Question about the confirmationbuttonextender control in the ajax tool kit

Is it possible to add code to this control? I am creating a mock credit card app and am using some of the validation controls(required and regular expession). When the user clicks "buy" and the info is not entered I have a Validation Summary popup box that shows up indicating that the fields need to be filled out correctly. After clicking "OK", the confirmation box pops up asking the user "Are you sure you want to purchase this software?". How to do I change this so the confirmation popup shows up after the validation is correct?

Thanks

Hi ts2527,

Based on my understanding, I think your concern is:
1. If the input is invalid, ValidationSummary control will pop up a prompt window.
2. If the input is valid, pop up a confirm window to confirm if user really want to continue. If user click "no", nothing happen. Otherwise, do something on the server side.

By the way, pop up a confirm dialog after ValidationSummary alert window is useless (for client validation), because the page is invalid and the request will not send to the server.

Based on my test, I implement it by RegisterStartupScript instead of extending the confirmationbuttonextender control. I hope it is acceptable to you. Following is the demo code.

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function ConfirmBuy()
{
var result = confirm('Are you sure you want to purchase this software?');
if (result)
{
document.getElementById('Button2').click();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" Style="position: static"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Style="position: static" Text="Button" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Style="display:none" Text="" />
</ContentTemplate>
</asp:UpdatePanel>
<input id="Hidden1" type="hidden" runat="server" />
</form>
</body>
</html>

*********** codebehind file
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "StartUpScript", "ConfirmBuy()", true);
}

protected void Button2_Click(object sender, EventArgs e)
{
//do something here
}