.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Need to save unique state for each PAGE (losing current filters)

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net


Nutshell: App has the ability to show same page with different settings at the same time, and the session state is too broad for that. I need to have a set of states, one for each page. 

My web page can display a scorecard that allows user to view or change scores for one or more possible sports teams (I changed actual business requirements to keep problem simple). For example, Team 1 can have positive score for some aspects of a game and negative for other aspects of a game. This page can show one or more teams side by side for comparison. The ability to add teams to the view is called filtering. There can be more than one view in a browser's tabs or new windows.

Here are my problems:

1. If the user presses Browser Refresh, they lose all current filters unless I use Session or TempData. Using Form Post does not work here. 

2. However, solution 1 doesn't work for multiple pages where the user wants to bring up 2 different views of the same page (for example, page 1 has Teams 1 and 2, and Page 2 has Teams 3 and 4). They cannot do this using Session or TempData. This only works if I pass the current filters to the controller via a Post Form Data data or in the Url.

3. The use of a url won't work because the data that needs to pass to the controller sometimes exceeds 500 characters.

I have googled this to no

View Complete Post

More Related Resource Links

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Knowing the event occured in user control in current page




      My web application has user control which uses third party controls called Devexpress controls. The user control is a menu  and is part of the Master page. It is placed there because this needs to be available in all the pages. My user controls raises a even on item clicked. Now, My question is that Is there any way to know that the event has occurred in page_load of the current page in which I am in?

how to automatically save new file into document library with a unique name or ID?

I've created a form using MS Word Document (2007) and lock it (protect it) so that users will be able to fill in the required fields.
then i've created a Content Type and uploaded the MS word form to be used as a template.

Then I've created a document library and enabled the content type and associate the above form for the library, so that when users click on New button the form will open.

everythings goes fine till here.

The problem is when users clicks on New and save the file back to the library, It doesn't save it with a unique name, instead it is over writting the existing one.
in other words, if employee 1 fill up the form and save it and later on employee 2 accessed the library and fill up a new form, he will overwrite what employee 1 has already saved!!

Is there a way to give every new created file a unique name? maybe (username+time)??

Request.PathInfo losing Master Page content and CSS link


Hi All-


I'm using Request.PathInfo to response.redirect as user to a different page ( based on the content after .aspx ).  It redirect just fine however, once redirected, the page loses all content from the master page and the CSS link.  I've searched and can't find an answer. 

Does anyone have a solution for this?

How to get current page file name?


I am trying to get the current page file name that i access to.
Lets say i am at test.aspx page, i want it to return me "test" file name.
I tried to use this.Page.toString(), it returned me "ASP.test_aspx" which is like half correct....
but i would like to get only "test".

2nd question, this.Page.toString() will always return me in a format of ASP.[filename]_[fileextention]?
If that's the case, maybe i can use splilt function to get the file name i want if there aren't any better solution than that.



Maintain Controls State on Master Page.

I have Web Application which uses the Logged In User (Authenticated User) to query his Profile Data from Adabas/Unix using OLEDB. The application provides the user with about 21 different pages (Basic Info, Employment Info, Education, Dependants, Financial Info ...). The web application has a master page, and each profile data page is based on a User Control loaded in the Child ASPX Page. Since we are migrating our legacy applications from Adabas/Unix to SAP, the development Team has prepared web services to query for the same Profile Data from SAP using Web Services. Now, we have to modify the web application to consume the web services instead of using OLEDB to query Adabas. Since we are in the testing phase, and we have only very limited data in SAP, I have to provide temporary control to allow test query the Staff Profile for a Specified User (instead of the Authenticated User) and to select the Source: 1. SAP, or 2. Adabas.   So I am thinking to add the following "Control Section" in the Master Page:<div runat="server" id="divSAPTest" class="SAPTest"> <span>Test SAP Web Services. Enter Staff ID: </span> <asp:TextBox ID="txtSAPStaffID" runat="server" Width="60px"></asp:TextBox> <span>From: </span> <asp:DropDo

SharePoint 2010 Publishing Site : Operation is not valid due to the current state of the object.

  I think as usual, the new version of SharePoint 2010 has a lot of problems. the below messege appear in a publushing site (FBA) enabled and when I try to access the pages list or even approve a page of accessing the SiteCollectionImages list and ......... etc every link produce the below error. I'm very frustrated with 2010.  Server Error in '/' Application. <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object. 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: [COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack>Operation is not valid due to the current state of the object.] Microsoft.SharePoint.Library.SPR

Operation is not valid due to the current state of the object

Dear people. Help me, please. I create simple sample project  Business Data Connectivity Model on Visual Studio 2010 (standard sample "Hello World") I edit file "Feature1.Template.xml": <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Feature  Id="bf21f627-600c-4eec-8c01-a49dac59a05a"           Scope="Farm"           xmlns="http://schemas.microsoft.com/sharepoint/"> <Properties> <Property Key="GloballyAvailable" Value="true" /> <Property Key="SiteUrl" Value="http://win-mne65kpc063/ForTestBCS"/> </Properties> </Feature>   I have Sharepoint Server. Site's local URL : http://win-mne65kpc063/ForTestBCS I press F5, and see error:       Error 1 Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.   0 0 BdcModelProject2 If I make deployment by the Central Administration, I have no error. But, when I display external list whith BCS-model I get error: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. <detail><errorstring xmlns="http://sch

Capturing state of the current scope.

is there a way to gain access to the state data for the current scope?

HTTPContext.Current.Session losing the variable sporatically

I have noticed a strange behaviour in my ASP.net 2.0 application. I have some logic in my aspx page that accesses some Session variables fine, then accesses some app_code and most of the time the HTTPContext.Current.Session returns the variable back fine.  However, I have noticed that sometimes this Session returns null, like it has lost it's "pointer" to the current HTTPContext. Is this a known bug, has anyone seen something like this before?   Any help would be appreciated, thanks, Mark. 

CSS - formatting block list items for the current page

I have a sidebar containing an un-ordered list (menu). Each list item is contained in a light grey block when the user hovers over it with the mouse. However I would also like the block to stay grey for the current page that the user is on. HTML <div id="sidebar"> <ul> <li><a href="../001.aspx">001</a></li> <li><a href="../002.aspx">002</a></li> <li><a href="../003.aspx">003</a></li> <li><a href="../004.aspx">004</a></li> <li><a href="../005.aspx">005</a></li> </ul> </div> <!-- end #sidebar --> CSS/* Sidebar */ #sidebar { float: left; width: 15%; padding: 10px 0px 0px 40px; } #sidebar ul { margin: 0; padding: 0px; list-style: none; line-height: 0px; } #sidebar li { font-size: 11px; line-height: 280%; text-transform: uppercase; letter-spacing: 2px; font-weight: normal; } #sidebar a { display: block; } #sidebar a:hover { text-decoration: none; font-weight: normal; color: #7584BD; background: #F2F2F2 } Very simple really, and used everywhere. I have been looking at free CSS examples to try and solve this problem, but the only so

The state information is invalid for this page and might be corrupted.

Dear All,     I got the following error today. But yesterday this application is running fine.     Even today i try to move this project to another server. The same symptom I got.     Does anyone know what's happened for this case?     Thanks, Best Regards, Benny Ng       Server Error in '/LGOldServices' Application.-------------------------------------------------------------------------------- The state information is invalid for this page and might be corrupted.Description: An unhandled exception occurred during the execution of thecurrent web request. Please review the stack trace for more informationabout the error and where it originated in the code. Exception Details: System.Web.HttpException: The state information isinvalid for this page and might be corrupted. Source Error: [No relevant source lines] Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NETFiles\lgoldservices\10b99f4d\fe7b353e\App_Web_jlz_zk70.4.cs    Line: 0 Stack Trace: [FormatException: Invalid character in a Base-64 string.]   System.Convert.FromBase64String(String s) +0   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +67   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(StringserializedState) +4   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter,String serializedState) +37   System.Web.UI.HiddenFieldPageState

{"Operation is not valid due to the current state of the object."} using WebService

Hi, i am using this method to insert managed paths into my WebApplication using the object model in a Web Project, but it seems that it's not working, always give me the bellow error: 1 - Content Database have AppPool user as DbOwner 2 - I can create site collections, but is writing in the SPWeb direcly, so when i use the WebApplication it will give me always the same error ERROR    at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)    at Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(HttpContext context)    at Microsoft.SharePoint.Utilities.SPUtility.ValidateFormDigest()    at Microsoft.SharePoint.Administration.SPPersistedObject.Update()    at Microsoft.SharePoint.Administration.SPWebApplication.Update()    at Microsoft.SharePoint.Administration.SPAutoSerializingObject.UpdateParent()    at Microsoft.SharePoint.Administration.SPPrefixCollection.UpdateParent()    at Microsoft.SharePoint.Administration.SPPrefixCollection.Add(String strPrefix, SPPrefixType type)    at WsCreateAddPaths.<>c__DisplayClass3.<CreateAddPaths>b__1() in c:\VS2010\SGE\App_Code\WsCreateAddPaths.cs:line 36    at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)    at Microsoft.SharePoint.SPSecurity.<>c__DisplayCla

Backup failing - Error "operation is not valid due to the current state of the object" ...........Ca

Hi, I am having a problem backing up a site collection, when trying to backup the collection I get the following error  "operation is not valid due to the current state of the object"............. "Category Info :InvalidData" . I'm getting the same error whether I use CA "granular backup" or "Farm backup", and using either STSAMD or Powershell. I can backup CA or the mysite collection but not the Home Portal site collection. As this is a production system I am really worried that something is going to happen and I'll have no backup. Does anyone have any suggestions on what i can do to either fix the problem or an alternative way to backup the collection or farm.  P.S. I am not using the "UseSQLSnapshot" parameter. Any ideas ? 

How to add a new button to the newform.aspx page which says "Save and add another record" ?

Team, I have a scenario where my client wants me to add a nother button to NewForm.aspx page in addition to Save and Cancel buttons. The job of that buttom should be to save the record and open that new form again. Is this possible.If yes can you guie me how to do it though designer? Thanks in advance. Deepti.  

Refresh Parent Page List after Edit Item Modal Dialog Save/Close

I am calling the Edit Item URL (EditForm.aspx?ID=x&IsDlg=1) via javascript code to bring up the Edit Item Modal Dialog. This works fine and dandy. But what callbackfunction should I invoke after the Save so that the parent list is refreshed? Is there a better way to do it than call reload on the entire parent frame? It almost looks like there should be a way to refresh just the list. Any help appreciated. Thanks, Jake.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend