State Management :: Dynamically Created Calendar Does Not Store Selected Value?
Sep 21, 2010[Code]....
Dynamically created calendar does not store selected value
[Code]....
Dynamically created calendar does not store selected value
Let me explain, describing the scenario:In a custom server control (in my case, derived from CompositeControl), in the overidden CreateChildControls method I create a complex tree of subcontrols, using information from a db.The db provides both information on which controls I need to create (the user interface's structure) and the data used to fill these controls.Than the user can interact with the control and change the data (that becomes different to what stored on db).
My custom control lives in the same page where there are other controls, obviously.And these controls can cause a postback at any time.What I need is that my custom control keeps the data entered by the user across these postback, without reverting to the original data and loose the user data entry.
Here is the first doubt:
1)I create the subcontrols dinamically in the CreateChildControls at any page refresh (both on first call than on postback).I know that the framework solves the reference between the posted data and the controls I create in the CreateChildControls in order to set properties and raise control events, but can you tell me when and how it actually does this? In which phase of page life cycle? What happens after the CreateChildControls?
A second doubt:2)If the user interface structure must change as a consequence of the data entered, I had to execute CreateChildControls twice (the first time to recreate the original interface to get the events and the second time to create the new interface)
In which phase of page/control lifecycle do I have to make the second call to CreateChildControls? I do it on Prerender now, but is it right or wrong, and why?
I have one textbox in this text box we will give movie name ,one file upload control this is for browse the mp3 files
after typing the movie name in the textbox, in solution explorer one folder has to create dynamically with the movie name given textbox and that movie name has to store in the database then using fileupload control we will browse the mp3 files that songs has to store in the folder specified by movie name then this songs path has to stores in the database according to movie name ...
How can I get the selected value of a radioButtonList if this is created dynamically? I know that a dynamic control must be recreated on each postback but, is there a trick to solve this scenario?
View 1 RepliesI'm using session to store C# object but my session is expiring regularly.
I've given 540 minutes for session timeout. ( <sessionState mode="InProc" timeout="540"/>)
Now I want to use cookie instead of session to remove this timeout problem.
code below:
[code].....
I want to store List<Class> object to ViewState, when i try to do this than its giving me error to make class serialize,but my class is partial class so didn't get serialize keyword on class how can i store List object to viewstate.
View 4 Repliesi want to store IQueryable value to ViewState. my code is as below:
Private
Property _Query()
As IQueryable
Get
Return
CType(ViewState("_Query"), IQueryable)
End
Get
Set(ByVal value
As IQueryable)
ViewState("_Query") = value
End
Set
but when i run my page i get following error:
Type 'System.Data.Linq.DataQuery`1[[DynamicQueries.VW_EmployeeProfile_Filter, DynamicQueries, ersion=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable
what should i do to get rid of this error. previously i was doing like this:
Private Shared _Query As IQueryable
but problem is that in Multi users environament, Shared variable is making problem, that is why i want to store it in ViewState.
I am using session to strore code
if (!string.IsNullOrEmpty(Request.QueryString["c"]))
System.Web.HttpContext.Current.Session["Code"] = Request.QueryString["c"];
else
System.Web.HttpContext.Current.Session["Code"] = "GR";
Instead of session,now I want to use cookies.
can i get few data from textboxes (like 12 text boxes) and store it in cookies? so the next time the user will not need to type the data again (so the data will place auto in the text boxes for the next times)
View 5 Repliesi am building an N-tier application now i want to store Data(like XmlNode) that is common to all users ..
now i thought using Application to hold the data but my data lays in the BLL tier which is an Class Library project and i can't store any datain there for example :
HttpApplication MyApp=new HttpApplication();
MyApp.Application["Data"]=XmlNode;
My question is what is the best way to store Data (not small data like user name etc..) is it Application? orCache?
i would like a small example within a ClassLibrary project
I have 2 arrays declared like this :
[Code]....
and i wish to put both in one session variable and then retrieve it to get one array like:
{"intItemID","strCategory","strType"}
I'm looking store an ArrayList into a session variable, but am having a few problems. Can you spot anything wrong?
public partial class _Default : System.Web.UI.Page { ArrayList score = new ArrayList(); protected void twist2(object sender, EventArgs e) { int a = 11; int c = RandomNumber(a); score.Add(c); score = (ArrayList)Session["scoreData"]; Result.Text = (c).ToString(); String Result_id = Result.Text; int total = 0; //Session["scoreData"] = score; for (int i = 0; i < score.Count; ++i) { total += (int)score[i]; } Sum.Text = (total).ToString(); String Sum_id = Sum.Text; }
I have a object of Class named "Employee" I need to store the object in the session. what happens if i do not serialize the object and store in the session.
View 7 RepliesI want to use something better thatn using the session to store global values, because it has somw problems
View 4 RepliesI have some webforms and the main page grabs the users email address when they login and a UserID. It's not uncommon for the user to keep the web page open all day. Is it good practice to store the email address and ID as a session variable and up the timeout to say 10 hours? Or is there a better way? My concern is A) Session variables timing out before the user login timesout B) Doing this incorrectly.
View 12 RepliesIn my website the page viewstate values in hidden are very large.So i wish to store this values into another methods(session,files etc).so please advice me to some methods..
View 3 RepliesI have two pages
First one is registration page.second one is Gridview page.
When i click on submitt button,the data will store in gridview.
If i want to update the data,click edit button.it will navigate to registration page with concer data.
I wrote code in first page as
[Code]....
In second page gridview as
[Code]....
Now the problem isWhen click on edit,data is stored in concern textboxes.but i open first page it diplays session data.it did not show empty textboxes.I want empty form wen i request first page and wen i click on edit it will store entire data in textboxes with update buttonand client id and client code readonly property false.how to do it?
While generating dynamic controls like , textboxes, dropdownlist, checkboxes and radiobuttons, after filling the textboxes and etc and submit and then postback occurs, the dynamic created controls missing. I try to find a way to make the controls persist for validation checking. Tried to use Viewstate to store the pnlTextBoxes and etc, but it has serializable error.
[Code]....
This is the strangest problem im facing(may be i missed something). The application works fine locally, but when uploaded on the live server. the session values are not retrieved properly.
i have stored a value in a session in master page's code behind. and afte the page is redirected is to another page, there im not able to retrieve the session value.
why this is hapening.. i remind you this is working perfectly on local server. problem is only when published on live server.
I read the solutioin for this error, at the following link :http://forums.asp.net/p/1046935/1576341.aspxbut I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?
View 4 RepliesI have a public property that I use to store a GUID in the viewState:
Property myGUID()
As
Guid
Get
Return
CType(Me.ViewState("myGUID"),
Guid)
End
Get
Set(ByVal
value As
Guid)
Me.ViewState("myGUID")
= value
End
Set
End
Property
I include this code on many pages in my website...is there any way to migrate this to a common code file, so I don't have to repeat it on each page? If I try to add it to a class file, the "Me" part of course is out of scope.
I have a class that being used to connect with the DB. Now I want to count how many times each web request executes the queries, but I've no idea where to store the counted value. I mean, Session wont, ViewState wont work as site also have webservices. What else I can use?
View 12 Repliesi am currently storing my shopping cart in a datatable assigned to the session. but i wanted to know is it a good idea to store the GUID for the session shopping cart?
View 6 RepliesI'm working on a web page that is going to be used to enter data into a database. The page is going to be dynamic in that the user has the ability to add a row to the table with the same fields, ie lname1, fname1, mi1 then lname2, fname2, mi2
I'm wanting to use a variable to keep track of how many lines there are so that when I generate the added line I am creating a new field with the ID of lname+# . Whats the best way to do this, a global variable, session variable? As side note, first time programming in .Net or C#.
I need to store viewstate in session to optimize my page performance on postback.
I am developing ASP.Net Website, using Visual Studio 2008.
I created a class named "BasePage" under "App_Code".
[Code]....
Now, I know if I inherit this class in all of my pages, that will work but I am looking to do this through Config file.
Is there any way that I can write something in Config file to use this class for all the pages?
so that if I want to remove, I can simply remove from config file and I do not need to compile my whole project again.