Maintain Current Page When Updating Top Level Parameter In MVC?

Nov 23, 2010

After working on a page for quite some time, the customer now decided that they wan't to be able to change a top level setting but still maintain the current page they're in.

Say for example:

User goes to default page, clicks on the UserSettings which is loading a partial view. In that partial there is multiple links like Address, Password, Other. Click Address (any of these) and it will load a partial within the partial. This will of course maintain the link "MyProject/User/1" in the URL bar.

When the User now change in the drop down in the top level, from User 1 to User 2 this will update the URL to be "MyProject/User/2" and will load the matching action with that. However, I wan't to be able maintain the user selection from before (MyProject/User/2, click UserSettings, click Address).

If I knew this from the beginning I would have done it completely different, but this now a request from the customer after the project is done so I'm look into if there is any "easy" way


I can also add that I've tried to do something like this to figure out what exact page I'm on:

var foo = window.location.pathname;

but that only gives me what ever I already have in the URL bar, and not any information about what partial that potentially would be loaded. Is there any way to see what partials is dynamically loaded at the moment?

Basically loading View -> Partial View -> Partial View. Changing the setting for the View but still want to maintain View -> Partial View -> Partial View, but now for the new User

View 2 Replies

Similar Messages:

Best Way To Maintain A 3 Level Hierarchy?

Oct 22, 2010

How can I maintain a 3 level heirarchy by using a gridview?

View 1 Replies

Web Forms :: Handle Error On Page Level Or Application Level?

Jan 31, 2011

I have to handle error related to web application. I am not sure how its works. I am thinking that I will add an error page (error.aspx) and in global.asax ,application_onError, I will redirecting the user to error page and that should be enough ! i mean it will handle error automatically.

View 4 Replies

Detect The Current Trust Level For Application

Jan 23, 2011

I found this code:

AspNetHostingPermissionLevel GetCurrentTrustLevel() {
foreach (AspNetHostingPermissionLevel trustLevel in
new AspNetHostingPermissionLevel [] {
} ) {
try {
new AspNetHostingPermission(trustLevel).Demand();
catch (System.Security.SecurityException ) {
return trustLevel;
return AspNetHostingPermissionLevel.None;

Get current ASP.NET Trust Level programmatically):

but for C#, and would like to have it for VB.NET. Any chance of someone expert in both VB.NET and C# that can translate this to VB code?

I tried myself and got the following VB.NET code but it generates an error inside my VWD:

Private Function GetCurrentTrustLevel() As AspNetHostingPermissionLevel
For Each trustLevel As AspNetHostingPermissionLevel In New _
AspNetHostingPermissionLevel() {AspNetHostingPermissionLevel.Unrestricted, _
AspNetHostingPermissionLevel.High, AspNetHostingPermissionLevel.Medium, _
AspNetHostingPermissionLevel.Low, AspNetHostingPermissionLevel.Minimal}
New AspNetHostingPermission(trustLevel).Demand()
Catch generatedExceptionName As System.Security.SecurityException
Continue Try
End Try
Return trustLevel
Return AspNetHostingPermissionLevel.None
End Function

These parts seems to be wrong:

New AspNetHostingPermission(trustLevel).Demand()

Continue Try

Obviously, need to be handled by someone fluent in both C# and VB.NET and can spot the errors in VB.NET

View 1 Replies

Configuration :: Error: The Current Trust Level Does Not Allow Use Of The 'AspCompat' Attribute

Aug 25, 2010

<%@ Page Language="VB" MasterPageFile="~/template.admin.master" AspCompat ="true" AutoEventWireup="false" CodeFile="AddNewResumes.aspx.vb" Inherits="AddNewResumes" title="Sarian solutions - Add New Resume" %>

total website with this page runnig in the local system. but when i put in online system it giving error like

Parse Error:The current trust level does not allow use of the 'AspCompat' attribute

View 9 Replies

Forms Data Controls :: Maintain Current Lists And Append A New List Below It?

Mar 19, 2010

I have a 'Read More' Button attached to the repeater control, and when it is clicked, the list currently displayed

should be remained and the new repeater list should be appended to the bottom of the currently displayed list.

And the 'Read More' Button should now be located below the newly created repeater list and it can be clicked again and the process above continues.

View 3 Replies

Page Level Security And Control Level Security In MVC Applications

Mar 9, 2010

how to implement page level and control level security in MVC applications. Also I would like to know the definition for Page Level and Control Level Security in MVC. Please refer me if any third party tools avilable to implement security in MVC.

View 1 Replies

C# - Updating SqlDataSource Parameter Via LinkButton?

Apr 10, 2010

I'll try to explain what I'm doing the best I can, but I'm pretty new to so be patient with me. I have a SqlDataSource which returns a simple select statement based on the WHERE clause using @COURSE_ID

What I want to-do is every time any one of 2 (this will change as it's going to be generated) asp:LinkButtons are pressed, they will change the @COURSEID value which i'd like to associate with the specific button.


<asp:LinkButton ID="LinkButton2" runat="server" onclick="MenuUpdate_Click">Course1</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="MenuUpdate_Click">Course2</asp:LinkButton>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:connString %>" SelectCommand="SELECT Chapter.chapterName, Chapter.chapterID
FROM Chapter
WHERE Chapter.courseID = @COURSE_ID
protected void MenuUpdate_Click(object sender, EventArgs e)
Parameter p = SqlDataSource1.SelectParameters["COURSE_ID"];

If anyone has any suggestions that'd be great, I've been trying lots of different things all night with no success :(

View 1 Replies

C# - How To Get The Current Project Directory Or The Bin Directory And Move A Few Level Up

May 24, 2010

I have an ASP.Net MVC app, and i have some xsl files inside of the Content directory.I've try a few methods to get directory dynamically buy keep on coming short.So how do i get the directory to point to the Content/xsl folder?the closest that i came to was with this:this.GetType().Assembly.CodeBase

which only returns the project DLL, but i can't figure out how to move up a few levels from there or what .net library to use to navigate around the path.there's no ../.. :(Basically i want to navigate to the Content/xsl folder which is at the same level of the Bin directory.

View 1 Replies

DataSource Controls :: Updating Data Using SP Taking XML As Parameter?

Apr 29, 2010

I have store procedure which can insert the data to table(s) by parsing the xml parameter provided.

Now, I wanted to modify the script such that it will allow update.


Now how I can modify the SP so that it will allow updating the stud table ?

View 1 Replies

State Management :: Maintain Query String Parameter In All Pages - It Gets Lost In Subsequent Pages

Aug 9, 2010

In my Application_BeginRequest I have code that gets query string value ?c=FR or ?c=US and store it in cookies.Based on query string value I have either US or FR,locale is selected from locale table.If ?c=FR then locale will be fr-FR and if it is US then locale will be en-US.My code is below.

void Application_BeginRequest(object sender, EventArgs e)
LocalizationInfo loc = GetLocalizationInfo();
if (Request.Cookies["Localization"] == null)
Response.Cookies.Add(new HttpCookie("Localization"));
Response.Cookies["Localization"]["Country"] = loc.Country;
CultureInfo objCI = new CultureInfo(loc.Locale);
Thread.CurrentThread.CurrentCulture = objCI;
Thread.CurrentThread.CurrentUICulture = objCI;
public static LocalizationInfo GetLocalizationInfo()
string countryCode = "";
string sLocale = "";
if (HttpContext.Current.Response.Cookies["Localization"]["Country"] != null)
countryCode = HttpContext.Current.Response.Cookies["Localization"]["Country"];
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["c"]))
countryCode = HttpContext.Current.Request.QueryString["c"];
if (countryCode == "")
countryCode = "US";
sLocale = HertzRent2Buy.DataProvider.ListData.GetLocale(countryCode);
LocalizationInfo ret = new LocalizationInfo();
ret.Country = countryCode;
ret.Locale = sLocale;
return ret;
public struct LocalizationInfo
public string Country;
public string Locale;

Now when I run the project and in query string I set [URL] then for the very first page(home page itself) it shows me French translation,but on subsequent page,that query string parameter ?c=FR is lost and hence it shows be English translation not French translation since it does not pickup French resx file.If I manually append ?c=FR in subsequent page then it shows the French translation.Is there is way how I can make that query stringparameter available in all pages.Structure is there to hold Country and locale variables. In all pages I am calling GetLocalizationInfo() method as follow

LocalizationInfo info = some.DataProvider.Globalization.GetLocalizationInfo();

And I create instance info to pass locale and country as parameter. GetProductDetails(id,info.Country,info.locale). why my query string parameters get lost on subsequent pages.

View 1 Replies

Data Controls :: Insert Current Date Into Database When Updating GridView Row?

Oct 24, 2012

I have gridview in which i had enabled edit update function. i want to insert current date when ever a user edits the row. my web is in, vb code, and database is in sql

View 1 Replies

Web Forms :: Find Current URL Of Page During Code Behind Submission (NOT Current Web App URL)

Aug 18, 2010

I am looking for a way to figure out the current URL that the page is currently on (NOT what the page currently is, but where the CODE is at). ie. My web app is located at: [URL] my code is: String page = [URL]

String response = GetResponse(page); //basically the above code goes to the website [URL] and parses the HTML within it and brings it back and populates the variable string "response". But, sometimes the [URL] throws me a curve ball and redirects me to: [URL] I want to be able to use a try/catch to be able to "catch" the error of a different page: ie validateUser.aspx. So, I need to do to this: try

String page = [URL];
String response = GetResponse(page);
//code to check the behind URL to see if [URL] is the URL OR IF [URL] is the current URL

understand I know how to find the URL of the current page the web app is on. I need to find the current page that threw the exception during the execution of the code behind.

View 1 Replies

Web Forms :: Get Name Of Current Page And Current Subroutine

Oct 17, 2010

I am building in error-logging into my site, and want to be able to get hold of the current page name that the error occurred in, as well as the specific subroutine or function, to then pass to a VB.NET function. Is there anyway to get hold of this information without hard-coding the names manually? For example,

Dim strCurrentPageName = ???
Dim strCurrentRoutine = ???

View 6 Replies

Iis7 - Configuration Granularity Between Machine - Level And Site - Level?

Apr 29, 2010

I want to be able specify to do the following: Specify configuration settings such as appSettings and connectionStrings for multiple web apps in IIS7 No editing Machine.config or the machine-level web.config Web apps are distinct web sites in IIS (not subfolder apps) Is this possible without just duplicating the configs for each app?

View 1 Replies

Method Is Only Supported If The User Name Parameter Matches The User Name In The Current Windows Identity?

Jan 30, 2011

get the below error. My application was working fine until I probably modified something, but don't know what.

Server Error in '/' Application.

Method is only supported if the user name parameter matches the user name in the current Windows Identity.

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.Provider.ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.]
System.Web.Security.WindowsTokenRoleProvider.GetCurrentWindowsIdentityAndCheckName(String userName) +2195661
System.Web.Security.WindowsTokenRoleProvider.GetCurrentTokenAndCheckName(String userName) +36
System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username) +61
System.Web.Security.RolePrincipal.IsInRole(String role) +182....

View 1 Replies

How To Maintain Page Load Time In C#

Aug 28, 2010

My question is that how to maintained page load time in c# and what page time load is good for site to crawl google index

View 1 Replies

Maintain Scroll Position On Page?

Jun 7, 2010

I'm using MaintainScrollPositionOnPostback=true property but this doesn't seem to work with chrome. (works on IE),

Is there any other way to maintain scrool position without using this property?

View 1 Replies

How To Get Web Page To Maintain Backend Spreadsheet

Aug 7, 2013

How to do something like this without actually downloading the spreadsheet to the local machine? Any tools or what not out in the world for doing something like this? Does sharepoint allow for .xlsx editing in a page?

Anything short of writing all the inputs and mapping them with backend code?

View 5 Replies

Disable ViewState At Page Level?

Apr 4, 2010

If I disable ViewState at Page level, will it be remembered for GridView inside the page?

View 1 Replies

Capture Errors On A Per-page Level?

Aug 9, 2010

I want to capture errors on a per-page level. I've added the following code to my code behind page:

public void Page_Error(object sender, EventArgs e)
Response.Write("Unhandled error on the page.");

I have also ensures that AutoEventWireup="true".

I have some gridviews on this webpage that use a SQLDataSource. I'm hoping to use this error message (which will be better when I get it working, response.write is mostly just to test) to cover up those errors with something more user friendly. Yet when I have an error ("Cannot open database" for instance), Page_Error never fires and I get the ugly yellow screen of death instead.

View 6 Replies

Web Forms :: Maintain Scroll Position Of Page

Jul 19, 2010

I want to maintain the scroll position of a page. So I try to get the page cordinates and set the position on the page load (actually I've a postback in my page) using JS as follows. What I've done is on a client click on an image get the page cordinates and keep in a hidden field.


GetScollerPosition function invoke in an image click event. But it's not work as I expected, the SetScrollPostion always find the value of hidden fields as zero.

View 8 Replies

Web Forms :: Maintain Page State Using NumericPagerField?

Jul 26, 2010

i have one listview with pager control as follows,

<asp:ListView ID="rgtListView" runat="server" DataSourceID="odjobs">

View 3 Replies

Setting Session Timeout At Page Level?

Jul 28, 2010

I have a site that when a user logs in it sets their initials into a session variable and sets the timeout value like so:


I want the user to be logged in for 3 hours. This does not work, the session expires after a short period of time, maybe 20 minutes. What do I need to change to make this page level validation work?I have tried setting in web.config also, but this doesn't work either.

<sessionState mode="InProc" cookieless="true" timeout="180" />

View 4 Replies

Configuration :: Set HttpRuntime ExecutionTimeout On Page Level?

Mar 30, 2010

We have a function which sends out a bunch of e-mails. The problem is that a HttpException is thrown on the server after a while.

I managed to find out the the solution is to increase the executionTimeout in web.config, but I only want this on one page, not the whole application.

Is there a way to set the executionTimeout configuration only on one page?

View 1 Replies

Copyrights 2005-15, All rights reserved