Web Forms :: Wizard Control Navigation - Button For Options?
Apr 8, 2010
I have a wizard control, which has 3 steps and the last is a complete step. I put on him a button in order to enable the user the option to return to the first step. How could I navigate back to the fist step?
I am using the Wizard control to create a webshop with steps. The wish is for horizontal navigation on top and the links should not link (plain text) yet but the links to previous steps should become links. My sidebartemplate: [Code]....
I am using Wizard control for password recovery. at first step I am checking the UserName with chkUserName(UserName.Text) function if UserName presents, the function will return the User Id and will navigate to next step, if UserName is wrong the function will return 0 and should not navigate to next step, but should stop at index 0 i.e. at the same step.
I have tried some solutions but it is navigating to next step in both the conditions.
I am using ASP.NET MVC 2 & .Net 3.5 with Visual Studio 2008. Ok, what I am referring to by 'Wizard type page navigation', is a site where you have a list of stages in a given process or workflow. There is some kind of visual denotation to indicate which part of the stage you are at. I have already implemented this part (albeit, it smells like a hack) via the following: css class current denotes active page. css class notcurrent denotes in-active page (i.e. page you are not on)
I declared the following method in a class called NavigationTracker. public static String getCss(String val, String currView) { String result = String.Empty; String trimmedViewName = currView.Substring(currView.LastIndexOf("/") + 1).Replace(".aspx", ""); if (val.ToLower().Equals(trimmedViewName.ToLower())) result = "current"; else result = "notcurrent"; return result; }
I have my stages in a control like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Import Namespace="TheProject.Models" %> <link href="../../Content/custom.css" rel="stylesheet" type="text/css" /> <% String currentView = ((WebFormView)ViewContext.View).ViewPath; %> <table width="100%"> <tr> <td class="<%= NavigationTracker.getCss("LogIn",currentView)%>" style="width:18%;">Log In</td> <td class="<%= NavigationTracker.getCss("YearSelect",currentView)%>" style="width:18%;">Year Section</td> <td class="<%= NavigationTracker.getCss("GoalEntry",currentView)%>" style="width:18%;">Goals</td> <td class="<%= NavigationTracker.getCss("AssessmentEntry",currentView)%>" style="width:18%;">Assessment</td> <td class="<%= NavigationTracker.getCss("SummaryEntry",currentView)%>" style="width:18%;"> Summary</td> </tr> </table>
To supplement this process, I'd like to create a user control that just has Previous & Next buttons to manage going through this process. So far, one snag I've hit is that this control cannot be put in the master page, but would have to be included in each view, before the form ends. I don't mind that so much. Clicking either the Previous or Next button submit the containing form to the appropriate action; however, I'm unsure on how to do the following: 1) Detect whether the Previous or Next button was clicked 2) Show/Hide logic of Previous & Next buttons at the beginning & end of the process respectively.
Another oddity I'm noticing with my application in general is that, after going through several pages of the process, if I click the back button, some values from my model populate on the page and others do not. For example, the text entered for a text area shows, but the value that had been chosen for a radio button is not selected, yet when inspecting the model directly, the appropriate object does have a value to be bound to the radio button. I may just need to put that last part in a new question. My main question here is with the navigation control. Any pointers or tips on handling that logic & detecting whether Next or Previous was clicked would be most helpful.
I had a thought to put a hidden field in the control that displays the Previous & Next buttons. Depending on what button was clicked, I would use javascript to update the hidden fields value. The problem now seems to be that the hidden field is never created nor submitted with the form. I've amended the controller post arguments to accept the additional field, but it never gets submitted, nor is it in the FormCollection. Here is the code for the hidden field. Note that its being generated in a user control that is called inside of the form on the parenting view (hope that makes sense). <% Html.Hidden("navDirection", navDirection); %>
In short, the solution was to have a Navigation class like the one suggested with logic to determine the next or previous page based on the current view & a string list of all views. A partial view / user control was created to display the Previous / Next buttons. The user control had 2 hidden fields: 1) One with the value of the current view 2) a field indicating navigation direction (previous or next). Javascript was used to update the hidden navigation field value depending on what button was clicked. Logic in the user control determined whether or not to display the 'Previous' or 'Next' buttons depending on the first and last views in the wizard when compared to the current view. All said, I'm pretty happy with the results. I'll probably find some code smell issues when I return to this, but, for now, it works.
Here is the code for the control I built to display the 'Next' & 'Previous' navigation buttons: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Import Namespace="Project.Models" %> <link href="../../Content/custom.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" > function setVal(val) { var nav = document.getElementById("NavigationDirection"); nav.value = val; } </script> <% String currentView = ((WebFormView)ViewContext.View).ViewPath; String navDirection = "empty"; currentView = NavigationTracker.getShortViewName(currentView); %> <input type="hidden" value="<%= currentView %>" name="CurrentView" id="CurrentView" /> <input type="hidden" value="<%= navDirection %>" name="NavigationDirection" id="NavigationDirection" /> <% if( currentView != NavigationTracker.FirstPage) { %> <div style="float:left;"> <input type="submit" value="Previous" onclick="setVal('previous')" /> <!-- On click set navDirection = "previous" --> </div> <% } %> <% if (currentView != NavigationTracker.LastPage) { %> <div style="float:right;"> <input type="submit" value="Next" onclick="setVal('next')" /> <!-- On click set navDirection = "next" --> </div> <% } %>
From there, you render the control just before the closing tag of a form on views you want it like so: <% Html.RenderPartial("BottomNavControl"); %> <% } %>
Now I can't really post all of the NavigationTracker code, but the meat of how it works can be deduced from the selected answer and the following snippet that returns the name of the view, based on the current view and the direction (previous or next). public String NextView { get { if (String.IsNullOrEmpty(this.NavigationDirection)) return string.Empty; int index = this.MyViews.IndexOf(this.CurrentView); String result = string.Empty; if (this.NavigationDirection.Equals("next") && (index + 1 < MyViews.Count ) { result = this.MyViews[index + 1]; } else if (this.NavigationDirection.Equals("previous") && (index > 0)) { result = this.MyViews[index - 1]; } return result; } }
Now, doing all of this has a few side effects that could easily be considered code smell. Firstly, I have to amend all of my controller methods that are marked [HTTPPOST] to accept a NavigationTracker object as a parameter. This object contains helper methods and the CurrentView & NavigationDirection properties. Once this is done, I can get the next view the same way in all of my actions: return RedirectToAction(nav.NextView); where nav is of type NavigationTracker. Another note is that the FirstPage & LastPage properties of NavigationTracker are static so I'm actually using NavigationTracker.FirstPage in my global.asax.cs file for my routing. This means I can go to my NavigationTracker class and change the flow in one place for the entire application.
I have a checkbox on my page that must be ticked and to validate it I am using a custom method as below. The problem is that I now put the checkbox and method within a Create User Wizard custom tempalte and when I submit the form it does not activate the validation check. If I put a normal button on the page outside the tempalte it works. Not sure If I a missing something. Perhaps I can activate it in Created User Event handler in code behind. All Button in my create user Event.
I have a <asp:Wizard> control with 6 or so steps. In the first 3 steps, I want to hide the default Wizard navigation (Next button, etc.), as each WizardStep's contents will handle that. For the last 3 or so steps, if possible, I want to use the built-in navigation. I've modified the <StepNavigationTemplate> contents, but that alone doesn't cut it, because it affects all steps. Here are my options:
Find a way to dynamically show or hide the StepNavigation from the codebehind. (I feel like this might be best -- is it possible?) Use StepType with <StartNavigationTemplate>, <StepNavigationTemplate>, and <FinishNavigationTemplate> to switch between navigation options (marking multiple steps as "start" or "finish" feels like it's abusing the mechanism) Switch to a <asp:MultiView> and handle navigation manually (I'd rather not do this)
I am trying to use wizard in an update panel but the wizard is disappearing when I click for the next or prev step button. I only want to close wizard , when I click the finish button. How can I do this ?
I have asp.net page that having the wizard control. I wanted to make visible false Next Button when other than Admin logged in (say dealer,subdealer log in). How to make it invisible or to change its text . I tried this line to make it in visible :
I have a Default.aspx program that contains a Treeview with a SiteMapDataSource. I also have a web.sitemap loaded up with urls. When I run the deafult app I get the tree layout that matches the numbers of options but no text on any of the options to click.
I have a sitemap with about 50 nodes. I want to expand the nodes for specific links directly related to the node group to which the current page belongs. Currently, when I navigate to a page, all nodes are expanded by default. Is there a properly I can use to control this behavior?
I want to navigate through multiple tab panels using buttons. I am sucessful in doing that using buttons on each tab.want to remove the hand symbol which looks like tab header is clickable and can navigate through header.i want to remove the hand symbol and put a pointer symbol instead.Is there any property i can do to achieve this.
coding in vb.net , asp.net 3.5 frame work for a web application.
I have a table in my database which consists of cID | cName| form1|form2| form3|form4| the form fields above are all checkboxes selected when the customer entry is done. there are they represent four forms that I have and are to be displayed later. I have a gridview that displays only cID and cName with a select link against each record. what I want to achieve is, when user clicks on the select link against a record, all the four fields are checked (whether true or false) and user is presented with the selected forms ONLY! how can I add this condition checking functionality to the select link? is there any alternate method to achieving this??
I want program test for student exam. One Question with five answer. For example.
Question
The capital of India.
Answer
A) Dushanbe
B) Moscow
C) Delhi
D) Kabul
E) Tokyo
I have many question with answers. When I define correct answer. Program generation always correct answer. In this question correct answer letter C. I want every time program automatic change.
I have got a Wizard with StartNavigationTemplate, StepNavigationTemplate and FinishNavigationTemplate. All of them have a button with ID btnSave while the FinishNavigationTemplate has another button with id btnFinish. I am trying to save draft while Save is clicked and Submit when submit is clciked.
My problem is that I can't figure out how to access the ID of the button on which I am basing my conditions. I tried the following code:
Dim btnSaveForm As Button = CType(sender, Button) Dim btnSave As Button= TryCast(form1.ActiveStep.FindControl("btnSave"), button) Dim btnFinish As button= TryCast(form1.ActiveStep.FindControl("btnFinish"), button)
Is that the correct way of accessing the button in a wizard footer template or am I doing it wrong?
so when i put my mouse on Customer, the child menuitem drops vertically. The problem is I have a panel on the page which I use Gray Color as it background color and child menuitems are hidden behind that panel. Is there a way to show the menuitems on top of the panel beside moving the panel further down?
I am a student and .net freshers.I have been working on a website using asp.net and has used menu control in it.it has various sections like home,about us ,customer care and i have set navigate url for each menu parts and submenus .but it is not navigating to respective pages while it is opened in browser. I have seen sitemap usage and iE8 compatiblity articles does it needs to be done ...cant it workout just by setting navigate url in property of menu?
I have a cancel button on a number of steps which when clicked allows the user to exit the wizard. However, I have a few steps that use the RequiredValidator control, which when the cancel button is clicked these validators are also fired. Also I have these steps inside User Controls as a oppose to being on one page. How do I stop these validator controls from firing when the cancel button is clicked?
I've built a website with a Horizontal Menubar at the the top of the site, it works fine the only problem is now that i have added more items to the website map it has now grown wider than the site, so what i would like it to do is when it gets to a certain width drop down and start adding the node links underneath. i tried setting the width property of the <asp:menu> but this did not seem to do anything at all. I could obviously add a second menubar linking to another sitemap but i would like to be as dynamic as posssible. Plus the menu is baseed around the role structure so some users may only see 5 items where admins, supervisors etc may see around 30 level 1 menu items with multiple subitems. so in short how to i make the menu wrap round to the next line when a certain length is reached
How to get rid-off ToolTip showing when people hover over menu items in asp:menu navigation control? The ToolTip itself covers pop-out sub-menu and very irritating. ToolTip actually displays "description" from Web.sitemap. I thought to delete "description", but that would be nice to have for asp:SiteMapPath.
Coding Platform: ASP.NET C# Controls Used: asp:Wizard and asp:Button
I have a asp:Wizard and when it renders it have Previous and Next ButtonsI would like to place a button to the right of Next Button.Now that button is being rendered below asp:Wizard Control.Any method to accomplish it? Update: I am not using StartNavigationTemplate, StepNavigationTemplate and FinishNavigationTemplate
In classic ASP I would write some logic to get a nice menu on the site, but now with the Menu-control, it's as easy as it gets.. Maybe to easy. I can't quite figure out how I would do this.. I have a multilevel navigation structure (from a database) that I want to put into the Menu-control, but I don't know which approach is the best/easiest way for me..
I'm all into performance, usability and all that.. The only thing I have really decided is that I want to use the Menu-control, I haven't decided what datasource I should use or how to style the individual links my way The data is coming from a database and is not supposed to be changed very often (maybe once or twice every month).. Thought of making an XML-sitemap, but also of making some sort of SQL-hookup.. I'm leaning towards the XML-sitemap because it wouldn't take long to generate the XML every time the navigation changes and that won't happen very often. The next issue is styling, how to do that? I have the neccesary css ready for the individual links, but I'm still unsure of how to get it to the Menu-control.. The css I have looks like below and in its current form is intended just for the anchors
how to i can use listview control with ado.net(without wizard),and insert image in itemTemplate when nothing is present in html code section....(i use an sql query to retrieve data,and i have image name in db,but i dont know howto show it in listview)
I have a wizard control and in one of the steps, I checked the input box if it's blank or not. By doing this, now the sidebar link and other steps all cause validation = true. How can I resolve this problem so that the cause validations for sidebars and other steps are false?