Keep State Of Multiple Usercontrols?
Jan 7, 2011
I am generating instances of a UserControl and putting them in an UL. In my UserControl there is a button with an event. I want to ask how I can keep the state of the UserControls I generated so that they remain on the page after a postback and also to catch their events.
For i As Integer = 0 To lstFoo.Count - 1
Dim liFoo As New HtmlGenericControl("li")
Dim ucMyFoo As ucFoo = LoadControl("userControls/ucFoo.ascx")
liFoo.Controls.Add(ucMyFoo)
ucMyFoo.DoSomething()
ulFoo.Controls.Add(liFoo)
Next
View 1 Replies
Similar Messages:
Dec 23, 2010
I have several dynamic user controls that I want to keep them in each postback. but the problem is when I click on menu item at first time, every thing disapeare in my page! even the things I created on design time. would somebody please help me to find out the problem of my code?it's realy urgent!!
[Code]....
View 13 Replies
Sep 21, 2010
I have a simple user control which contains a textbox and a dropdownlist. I need to add this control multiple times to my page then save the details to my db, validating each control. When they re-enter my page I need to load the user control for each record in the db populated with the data they entered. They can then edit the data, delete the row or add new rows.
I'm trying to find the cleanest most efficient way to accomplish this. I realise I would need to re-add the user controls after each postback re-populating the data. Would the best way be to add each row to an arraylist or list of type object, save it to the viewstate and re-add the controls with data on postback, or is there another method which would suit?
View 13 Replies
Mar 1, 2011
I want to create several instances of a webcontrol on my web page each time the user clicks an 'add' button.
HTML
[Code]....
c#
[Code]....
View 7 Replies
Mar 9, 2011
I have a userControl with with two DDLs and two RBLs, and public properties to get/set the values. If I register the UC on a page it works fine....I can set/retrieve the values without a problem.
I need to create multiple UCs based on records I'm pulling from a dB, so I'm trying to instead create the UCs programmatically. I'm testing this by adding a reference to the control ("symptomBasic"), creating a placeholder ("ph1") on a page and then trying to populate it with the UCs in PageInit. (the parent page uses a master page)
Partial Class testUC
Inherits System.Web.UI.Page
Private myUC As ASP.symptomBasic
Protected Sub Page_init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim i As Integer
For i = 1 To 3
myUC = CType(LoadControl("~/controls/symptom.ascx"), ASP.symptomBasic)
ph1.Controls.Add(myUC)
Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
When I load the page, I get three UCs in a row, and they work properly on postback...i.e. all the values are preserved. Question is, how do I then find the controls on postback when I want to populate them with data or read the values back?
Let's say I know I returned 3 rows from the dB and created 3 UCs during pageInit...how do I then access those controls to read back the values provided by the user? I see that each control has an ID like: "ctl00_ContentPlaceHolder1_ctl01_cName", where each set of controls is "ctl00", "ctl01", etc.
View 9 Replies
Apr 7, 2010
Is it better for a collection of ASP.NET web apps to share the same session database, or should each one have its own? If there is no significant difference, having a single database would be preferable due to easier maintenance. Background My team has an assortment of ASP.NET web apps, all written in either Monorail 1.1 or ASP.NET MVC 1.0. Each app currently uses a dedicated session state database. I'm working on adding a new site to that list, and am debating whether I should create another new session database, or just share an existing one with another app.
View 1 Replies
Aug 30, 2010
#Newbie alert# Only 8 months experience with school education back in 2002.
I'm using VS 2008, C# 3.5 to develop my own login system for our company website.
Originally we have a "simple" design which only had a login and order page.
That order page needs to be opened for 10-12 hours at the time while our stores are opened without having to relog into the system for each query.
We also have a requirement that some users need to access 2 different compagnies (separate inventories) which require 2 different logins.
I solved that "cross over" session problem by moving all the values into viewstate with my own viewstate manager class right after the login.
Now my problem is that we are adding more and more pages and I don't want to be stuck with the problem to resave the viewstate to session and then back on viewstate for every menu items and buttons.
Is there a way to create some sort of items list of all the sessions opened by the user and only transmit that from pages to pages?
View 6 Replies
May 27, 2010
i want to know if i want to use multiple server for my application. what should i do.e.g. if i used session to store some important data so as session get stored on server if my application use one server and server get crashed then my application also get crashed. So to avoid this problem what should i do (if solution is use multiple servers then how can i do that)
View 2 Replies
Dec 7, 2010
I have a application where login details are in 1 database and user details are in another database.Different cities have different database with common login database.As soon as user logs in i save the connection string name of its associated city database in a Session to access through out the application.Was wondering if this is the best possible way to do this? Will this cause a problem in Web Farms? Please let me know what is the best possible way to save a value which can be accessed through out the website and till what time is the value valid or expires?
View 6 Replies
Oct 22, 2010
I have to get the multiple records from the gridview and store it in the session. Can any one send the coding for this?
View 5 Replies
Apr 16, 2010
I have 2 front end servers and 2 back end servers. There is a registration form in my web application. The registration form uses a Microsoft Wizard control. Lets say the Wizard control has 4 steps. After the fourth step, users click "Finish" and I display the "Thank you Message". The way the request is routed between the 2 servers is round robin. So lets say till the fourth step, the response comes from server A. After the user clicks "Finish", lets say the response now comes from server B. After they click "Finish", I am trying to access some information in the Wizard control (like Name, address and so on). Because the servers are now switched, the data is lost (at least thats what I think is happening). So all entries in the wizard control are now blank and when I try to read those values, they are null.
View 8 Replies
Mar 12, 2010
I have a bunch of EC2 servers that are load balanced. Some of the servers are not sharing session, and users keep getting logged in and out. How can I make all the server share the one session, possibly even using a partitionresolver solution
public class PartitionResolver : System.Web.IPartitionResolver
{
private String[] partitions;
public void Initialize()
{
// create the partition connection string table
// web1, web2
partitions = new String[] { "192.168.1.1" };
}
public String ResolvePartition(Object key)
{
String oHost = System.Web.HttpContext.Current.Request.Url.Host.ToLower().Trim();
if (oHost.StartsWith("10.0.0") || oHost.Equals("localhost"))
return "tcpip=127.0.0.1:42424";
String sid = (String)key;
// hash the incoming session ID into
// one of the available partitions
Int32 partitionID = Math.Abs(sid.GetHashCode()) % partitions.Length;
return ("tcpip=" + partitions[partitionID] + ":42424");
}
}
View 1 Replies
Oct 1, 2010
for avoid (Preventing) Multiple Logins in ASP.NET
View 5 Replies
May 26, 2010
I am sorry if this is been discussed earlier. I am having a problem maintaining the session when someone uses the same browser with multiple tab, the results gets messed up. A perfect example would be, [URL] if you open IE (or any other browser) and open two tabs and search for two different air travel itinerary and the results will completely overlapped (real mess). I know the cause for this problem (both tabs uses the same session). I would appreciate if somebody have any solution for this. I am using ASP.NET 3.5/VS 2008/VB.NETI will not be able to use Viewstate since I use a master page and pre-init event where view state is not available.
View 2 Replies
Jul 9, 2010
I have 2 different applications hosted on an IIS server. I have created a new application pool.Can i run both the applications on the same pool??Will sessions or other values of one application be available to the other application if I do it this way?
View 2 Replies
Nov 18, 2010
I want to pass multiple values to another page from my gridview. For sending i got this codes : (writing same page selected values)
[Code]....
Here is my question How can i catch from another page this values?
View 6 Replies
Apr 20, 2010
i have 2 different sites under different subdomains.
www.company.com
and e-order.company.com
i want to have SSO so i have tried to make a global cookie.
my question is :does the global cookie keeps the session variables when i am going from one site to another?
if not how can i pass a session variable for ex. session("userName") from one site to the other on redirect?
View 4 Replies
Aug 31, 2010
I have a main website say www.main.com which is developed in asp.net. We have used forms authetications here.
Now the thing is I have a no of subdomains on the same server say domain1.main.com, domain2.main.com, domain3.main.com etc.
I had put some functionality there. What i want is when i redirect my users to the subdomains user has to log in again.
what are the method where i can preserve the users state in my subdomains also.
View 5 Replies
Jul 9, 2010
I have a DataTable which holds information on truck routes. When the user click on a route it display another table with details about the stop along that route. When they click a stop it shows what items were picked up at that stop. Three separate pages with 3 distinct DataTables. Currently I am storing them in the session. Normally, I would use the view state since the data only needs to live on that page. The reason I use the session is because each page is part of a Master pagelayout. There is an export button in the master page which gets the data in the session and exports it to an excel file. The issue is that when the user goes to the item level detail and uses a quick navigation link back to the route information the data for route is not reloaded into the session, just the page. If the user clicks export it will export the data set from the item level detail even though it is not displayed on the page
View 4 Replies
Feb 13, 2011
I have created a object in ASP.net C# that is a collection (arraylist) of Arrest Warrant objects. How do I make that object available to multiple pages?
View 6 Replies
Jul 29, 2010
I have a parameter screen which contains many pop up windows for the parameters .
I have a department hierarchy which consists of department , branch and section.
I have 3 pop up windows for each parameter.
When i select, a department, it filters the list of the branch and shows only its branch when i open the branch pop up window.
But the problem is, when i select multiple departments, the branch pop up window shows the below error. The page works if only a department is shown.
Conversion failed when converting the nvarchar value '3,4,5,6 to data type int. 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.
My code for the branch page is :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Branch.aspx.cs" Inherits="Modules_Reports_Branch" Title="Select Branch"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
[Code]....
View 4 Replies
Jun 23, 2015
1.Viewstate is only for single page
2.querystring and cookies not i want to use
is there any other option to use Client side state management for multiple page like viewstate encryption.. ?
View 5 Replies
Sep 1, 2010
I am trying to incorporate AJAX in my web project for the first time and it isn't working. I don't know how to instantiate a class once and use AJAX to update the dataset numerous times before updating the database changes using a postback.
My project is to learn AJAX with a class object. Clicking the button is supposed to increment a count by one using a class to store the count. Here is my class:
[Code]....
Here is my HTML code:
[Code]....
And here are my button click event code snippets:
[Code]....
My problem is that as I step through the code (after clicking on the second button) it instantiates a new class object each time which returns a value of 2 every time. I have tried to fix the problem by putting my counter class instantiation in the pageload event using "If Not IsPostBack Then ..." but my probem there is that the button click event block of code would not recognize the cCount class - it put the blue lines under the cCount
My goal is to have the class object available to multiple events in the code behind: especially using AJAX to build records in one of my DataSet tables Does anyone know how to handle this?
View 6 Replies
Jan 25, 2011
just been trying to recieve the session value from multiple jquery ajax requests on the same domain name. i think i understand that each request is kind of a virtual browser request so the session is mutally exclusive to each request, but there must be a way some how, has anyone solved this. Basically this is what im trying to do:
I have tries using type: GET and POST but still no luck.
First request - Stores the product id in a session
[code]....
View 1 Replies
Oct 13, 2010
I have a web application using window authentication. There are a search page and a edit page in the application. In search page, user can enter some search criterias in the textboxes and the search result will be displayed in the gridview by clicking the "Search" button. User can select any row from the gridview and it will take him to the edit page. In the edit page, there is a "Back" button to take the user back to the search page. I use session variables to remember what the search criterias the user entered in the textboxes and what page number the user was in the gridview. So when the user goes back to the search page, the textboxes are pre-populated with the search criterias and the gridview is displayed in the correct page number.
The problem is: If user1 opened one browser window and did a search using search criterias1, then user1 opened a 2nd browser window and did a search using search criterias2. When the user1 went back to the search page from the edit page using the first browser window, all the textboxes and page numbers are from the 2nd browser window, instead of the 1st one. Can anyone explain this problem to me and how to prevent it? It will be helpful too if you can give me some links about the similar problem. I am thinking if the same user logged on two different machines and did the search on each machine, what is the result?
View 4 Replies