Dynamically Show / Hide Wizard Navigation Controls
Oct 15, 2010
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)
View 1 Replies
Similar Messages:
Jan 14, 2010
I have created a wizard control. Now i would like hide all the Navigationbuttons, for example
- stepPreviousButton
- FinishPreviousButton etc.
How can i do than in my code-behind?
View 6 Replies
Jul 15, 2010
I want to hide or show a wizard step. Based on the inputs on the prvious page. For example If some one choose "4", the step 4 should be visible. else Step 4 should be hidden. I tried something like this
[Code]....
View 2 Replies
May 7, 2015
I am checking string and then bind category. If condition is false then i need anchor tag in which i pass querystring to specific link.
<itemtemplate>
<asp:Literal runat="server" ID="litPrice" Text='<%#((String.IsNullOrEmpty(Eval("Price").ToString()) || Eval("Price").ToString()=="00/0.00" || Eval("Price").ToString()=="0/0.00") ? "<span font-family="arial"><a href="http://www.xyz.com/web/enquiries.asp?category="+ Eval("category")>Enquiry</a></span>" : Eval("Price"))%>' >
</asp:Literal>
</itemtemplate>
I am getting error. CS1010: Newline in constant
View 1 Replies
Mar 4, 2011
I am Trying to hide Navigation Menu Item on my master page based on a selected item from a Drop Down List on another page. I think i need to use a session to get the pages to communicate, which i can do just fine. Im having a problem putting together the code to actually Hide the link based on the specific answer of the DDL.
View 11 Replies
Jan 24, 2011
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]....
View 5 Replies
Jul 2, 2010
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.
View 3 Replies
Aug 11, 2010
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.
in aspx the code is like:
[Code]....
View 5 Replies
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?
View 1 Replies
Sep 30, 2010
I am using a SiteMap data source boudn to a navigation control. I would like to also put this in the footer (sort of like the bottom of Yahoo! pages) where all items are expanded and static.
So my major heading would be across the top (horizontal) and the sub items would be indented vertically below and always expanded. Is there a way to do this? Check out the bottom of the BlackBerry DEVCON 2010 site for an example:[URL]
View 3 Replies
Mar 16, 2011
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 :
[Code]....
but sounds nothing there. what have to do ?
View 1 Replies
Jan 14, 2010
I will have a web site which include serveral functions for a training coudrse. For example,
1. Search the course
2 . Register the course.
What I want is to show the current status in the left pane of the browser. for example, if the user is searching the course, then in left pane "serach course" Will be highlighted. If the user is registering the course, then in left pane "registering course" will be highlighted.
View 3 Replies
Jun 30, 2010
I want to show and hide a label and its control. I can do this in c# in the code behind. But, I can only show/hide the control. Any ideas?
<asp:label AssociatedControlID="thisLabel" runat="server">This:
<asp:label ID="thisLabel" CssClass="ascontrol" runat="server" />
</asp:label>
I want to be able to show and hide that whole thing depending on what user gets to the page. I just need to know how to show/ hide that whole thing in the c# code behind...cannot seem to get the visibility of the wrapper label to go away.
View 3 Replies
Oct 13, 2010
what is the best way to show/hide controls in .net?
I have a page with many show/hide depending on the control value.
eg. radio button list rbl (dynamically generated from the database values)
based on the radio button list value,will need to show/hide the other controls.
if the value is 1, will need to show or hide dropdownlist1.
if the value is 2, will need to show or hide dropdownlist2.
I tried using the javascript with rbl.Attributes.Add("onChange","return toggleDropdown();")
then in my javascript function i will show/hide the control.
However when I toggle the dropdown for the second time, it became very slow. The first time is okay.
I have also tried using ScriptManager and UpdatePanel (putting the controls inside the UpdatePanel), but it is also very slow when toggling dropdown for the second time onwards, causing the page to hang.
View 4 Replies
Mar 10, 2011
I am using a ListView to display a list of Products. My DB has a field named productImage. What I want to do is show this row if there is a picture associated with the product, Hide this row is there is no picture associated with the product.So on the Listview_ItemCreated Event I have this:
[Code]...
View 7 Replies
Jun 7, 2010
i placed 2 user controls UC1 and UC2 in main.aspx page. i need to show or hide some controls in UC2 from the button in UC1 how?
View 5 Replies
Jun 29, 2010
I have 3 linkbuttons in a footer-template and want to be able to hide/show one of them at will. How to do so?
View 8 Replies
Feb 14, 2011
I basically need some items in a grid however each item contains subitems so I need a +/- type button to show/hide them. Is there a control to do this or would it be easier to simply put them in a CSS table and use jquery or something similar to control the hide/show of subitems?
View 1 Replies
Nov 23, 2010
Is there a way to show/hide (visible = true/false) a textbox and/or dropdownlist at PageLoad (or other Page cycle) from codebehind (I would like to check for some permission regarding current user and show/hide some controls from aspx page) ?
View 2 Replies
Jul 22, 2010
Protected Sub SQLDShowActionRef_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SQLDShowActionRef.Selected
View 4 Replies
May 7, 2015
idnamaimage
2
perda
file/tutorial.pdf
1
gdfgg
file/Doc1.docx
How to show link view file in gridview using asp.net ....
View 1 Replies
Jul 16, 2010
I have an emergency request that I need to sort it out very quickly as I did not notice it early :(.
I have a dropdownlist, the contnet in the gridview (sqldatasource connection) changes based on the value the user slects, say I have play1, play2 from the dropdownlist, I would like to show column1, column2 and column3 with user selects play1; show column4, column5, and clomn6 when use selects play2; the datatable actually includes all 6 columns.
I understand that I need to use something like RowCreated event, and I need to set up condition based on the dropdownlist value, but I dont really know how to.
View 3 Replies
Apr 2, 2010
On a page of my project, i have a gridview, i need to perform following operations with it:
1. On Page_Load i want to bind all the data (100 Rows) with the gridview.
2. On my Page i want to show only 4 records with Show More/Show Less Links.
3. When user clicks on the link, i want to show All data or 4 Rows accoeding to the link.
4. I don't want any roundTrip to the server, so plz don't suggest AJAX, i want to attain this by using Javascript.
View 3 Replies
Jul 15, 2010
I have a webpage that lists information about trucks and their map sections and whether the combination is active and will be used.
On the page I put a check box that says Show Only Active and marked the checked property as true by default. When the RowDataBound event fires I check to see if that checkbox is marked as true and if it is I check if the individual map sections are marked as active. If they are not active then I set the row visibility equal to false like below.
[code]....
View 1 Replies
May 24, 2010
dv = new DataView(table);
Table.Columns.Add("ID", typeof(string));
table.Columns.Add("Type", typeof(string));
table.Columns.Add("EmpName", typeof(string));
table.Columns.Add("Manager", typeof(string));
row = table.Rows.Add();
row["ID"] = result["ID"].ToString();
row["Type"] = result["Type"].ToString();
row["EmpName"] = result["EmpName"].ToString();
row["Manager"] = result["Manager"].ToString();
Then I am adding boundfield to gridview for all 4 columns. Now I want to check if "Type" column contain "Sales" thne do not show "Manager" columns. Let me know can I do this?
View 4 Replies