CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!
Free 3 Months



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/22/2004 3:29:39 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
darbhas
Asp.Net User
UserControls & Session Variables3/22/2004 3:29:39 PM

0/0

Hello All,
I have three user controls - Step1 (Step1.ascx) ,Step2 (Step2.ascx) & Step3 (Step3.ascx) , which I have included in a webform as follows:-



<ucSteps:step1 id="UCStep1" Title="Contact Info" runat=server></ucSteps:step1>

<ucSteps:step2 id="UCStep2" Title="Company Info" runat=server visible=false></ucSteps:step2>

<ucSteps:step3 id="UCStep3" Title="Confirm Info" runat=server visible=false></ucSteps:step3>




In Steps 1 & 2, the user will be entering his Contact and Company information and in Step3 he will have to confirm the information to be finally stored in the database. The visibilities of the steps are changed accordingly.

I have a dataset that contains ContactInfo and CompanyInfo tables. So at Step1 when user submits his contact information, it is stored into ContactInfo table and the dataset is stored in a Session variable. At Step2, the dataset is retrieved from the session variable and
just like step1, Company information is stored into CompanyInfo table. Again the changed dataset is saved back to the session.

Now comes the problem, In step3, I'm just displaying all the information thats been entered till now. For this I retrieve the dataset stored in the session variable. I am able to access and display Contact Information from the DataSet. But when I access CompanyInformation from CompanyInfo table of the DataSet, I found out that there are no rows in that table, which doesn't make any sense to me, because just in the previous step I have inserted a new row into CompanyInfo table.

But to my surprise, when I refresh the page, I see even the company information also.
So my question is, am I doing something wrong in storing dataset into Session variable or is it something that has to be done with the user control usage.

I have even checked the event handling in step2 which is also working properly.

Or Is there any other good practice of passing information between user controls?

Any input is highly appreciated,
Thank you.
master4eva
Asp.Net User
Re: UserControls & Session Variables3/22/2004 5:12:27 PM

0/0

:: I doing something wrong in storing dataset into Session variable or is it something that has to be done with the user control usage.

I think that it has to do with the paging technique that you have employed. My best guess, without looking at your code, is to have this formation in each user control like so:

protected override OnPreRender(EventArgs e) {
base.OnPreRender(e);

if (Session["CurrentStep"] == null)
Session["CurrentStep"].ToString() = ID;

if (Session["CurrentStep"].ToString() == ID) {
if (Page.IsPostBack) {
// save the data to the session

bool focusNextControl = false;

foreach (Control sibling in Parent.Controls) {
if (focusNextControl) {
Session["CurrentStep"].ToString() = sibling.ID;
break;
}
else if (sibling == this)
focusNextControl = true;
}

Visible = false;
}
}
}

-- Justin Lovell
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
OOP: Building Reusable Components with Microsoft Visual Basic . NET Authors: Ken Spencer, Tom Eberhard, John Alexander, Pages: 500, Published: 2002
Inside ASP.NET Authors: Scott Worley, Pages: 704, Published: 2001
Beginning Visual C# 2005 Authors: Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White, Pages: 1062, Published: 2006
ASP.NET by Example Authors: Steven A. Smith, Pages: 552, Published: 2002
.NET Wireless Programming Authors: Mark Ridgeway, Pages: 564, Published: 2002
XML.NET Developer's Guide: Developer's Guide Authors: Adam Sills, Jonothon Ortiz, Pages: 566, Published: 2002
MCAD/MCSD Training Guide (70-315): Developing and Implementing Web Applications with Visual C# and Visual Studio. NET Authors: Amit Kalani, Pages: 1200, Published: 2002
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006

Web:
Session Variables not available in UserControl Talk about Session Variables not available in UserControl. ... usercontrol works fine, but the session variables are empty. ...
Web User Controls and Session Variables - ASP.NET Forums Because web form's Page_Load method get's executed before it calls the user control's method. So, the session variable is not set yet in the ...
CodeProject: Manage ASP.NET Session variables using the Facade ... For example if i have a user control that uses session variables, and I place it on different pages, then the variables would all be cross accessed. ...
ViewState, Dynamic UserControls, and the Back Button - .NET ASP My web application dynamically creates a UserControl and saves it to a Session variable called LastControl. When a postback occurs, I simply ...
can someone tell me how pass user control values to session ... can someone tell me how pass user control values to session variable. Last post 03-26-2008 12:20 AM by satalaj. 3 replies. Sort Posts: ...
User Control events in C# - Computing.Net My problem is making sure the right user control is being loaded in. Because the events are fired after page load my session variables are ...
Session Variables [Archive] - Xtreme .NET Talk [Archive] Session Variables Visual C# .NET. ... UserControl.Session' denotes a ' property' where a 'method' was expected ...
Problem accessing session variable : c# UserControl Adding Data to Session: protected void cmdAddMember_Click(object ... 4, How do I pass a session variable value to a textbox on a formview th… ...
User control refresh Oct 25, 2005 ... was clicked the usercontrol sets a session variable and a cookie ... are other usercontrols in the same page that read that session variable ...
DotNetSlackers: Tip: When Adding Dynamic Controls, Specify an ID ThisLoadPageControls() methodlooked at a Session variable -if the session variable was set to a user control path, that user control was loaded into the ...




Search This Site:










custom treeview child controls lost on postback

ipostbackdatahandler.loadpostdata not firing

server, for a network with in about 3000 client?

can you copy aspnetdb content into an existing database?

handling <% %> code blocks in customer server controls

persist controls for design-time added custom template

custom controls and localization

loding a usercontrol winth in an other user control

user control

calendar control need some help

extending placeholder

custom event in user control call event method by name

'[propertyname]' could not be initialized.

reg "registerclientscriptblock"

anyone hosting with ucvhost.com?

rebuilding a control on postback

dotnetpark hosting problem

web custom controls - calling control

windows hosting certification exam for it professionals now available!

editing collections

i am goingt to use dedicated server but ... ?

got hacked ???

help! custom validator and sql

asp.net 2.0 webrequest method in a shared hosting environment

what to open url and make button visible

custom controls and vs.net designer ...

any one hosting with ultima now.....?

custom datagrid control help

application-level registration of user controls?

facebook api calls take 4-5 seconds to return from godaddy hosted site

  Privacy | Contact Us
All Times Are GMT