Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Maintaining state between two user controlsMaintaining state between two user controls
Previous
 
Next
New Post
12/3/2008 1:09 AM
 

Dear Friends

I have developed a module "Biodata" and it contains two user controls

1.ViewBioData.ascx

I have a dropdown with "Classes"  loaded in viewbiodata.ascx. Depending upon the class selected, the list of students in the class will get displayed in a datalist.DataList contains the list of student name in the datalist with paging and sorting. On Clicking a student name, it would redirect to "ShowbioData.ascx", which would show the bio data of the clicked student. I have a back button in the showbiodata.ascx clicking which it must get to the viewbiodata.ascx page with the datalist being maintained and also the page from which i clicked initially.

My Problem is  I have implemented the other things, but on clicking the back button, i could not maintain the initial datalist and the paging in viewbiodata.ascx

kindly guide me in resolving this issue.

All replies are appreciated.

regards

deepak

 

 
New Post
12/3/2008 9:15 AM
 

Deepak,

There are a few different things you *could* do with this but some more advisable and others less so.  Essentially though you are going to need to rely on some sort of "state" mechanism that doesn't include v13wstat3.  Options:

1) Use Session State.  I'll note here that this is very unadvisable because, in general, session state with DNN is not a good idea.  The reason behind this (and maybe not a problem in your case) relates to web farms.  Session state is not easily transferred between a web farm unless you use a stronger session state method such as the State Server or SQL (neither of which are enabled by default).

2) Use Query Strings.  While this is a little more difficult and will require you to actually rebuild the datalist on each request instead of having it cached in some true state mechanism, this is the most portable.  There is no reason why you couldn't encrypt the "state" to pass between the two controls so it couldn't be modified by the user.  You would have a method to rebuild the data that takes the querystring values as parameters and then returns the datalist.  Of course, if you are using straight databinding to the database instead of say, an Object datasource, this would work differently.  At any rate, clicking the student name in the first page would include the current filter, paging, and sorting as querystring parameters and redirect to the details page.  Any click on the "back" button to return to the master view would then include the same querystring values as parameters and return to the master page which would rebuild the view based on the querystring values.

3) Use "custom" state.  You could store the last query of each user in your own specialized database table... so every time they resort or change pages it updates that table with their selection.  This would allow them to leave the page altogether (even log out) and when they come back have it where they left off.  On that same note, you could expand it to store their "favorite" query as well.

Option #1 is the "easiest" but probably not the most correct.  Option #3 is the hardest and probably overkill anyway.  Option #2 is middle of the line and probably the most correct (IMHO).

Good luck!


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
12/3/2008 9:23 PM
 

As was mentioned above, Option #2 is the "DNN" way of doing this and is probably the best in that emitting the current filter, page, StudentID parameters on the querystring allows the user to easily bookmark the details view.

A fourth option is to use only one control with the appropriate mechanism (Panels, MultiView, ListView/DetailsView control, etc.) to hide the list/reveal the detail, etc. without having to redirect from control to control. With this approach, v13wstat3 will be available for maintaining page state. A variation on this option would be to have one module control containing the list and have that dynamically load the detail control as a child control. I often prefer the latter approach when giving the user a choice of several different detail views. 


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
12/3/2008 10:35 PM
 

William Severance wrote
A fourth option is to use only one control with the appropriate mechanism (Panels, MultiView, ListView/DetailsView control, etc.) to hide the list/reveal the detail, etc. without having to redirect from control to control. With this approach, v13wstat3 will be available for maintaining page state...

This "fourth option" that William stated is what I tend to do.  I like to employ AJAX to retrieve detail data and, unless a more complex UI is demanded, do simple hide/show of data using javascript and DIVs. 


DB-Based State Storage and Timestamps

As stated by Fooberichu, you can keep track of view state by storing state info in a DB table.  To this I'd add that it can be a very nice thing to include a timestamp with the stored state info so you can chose to "expire" the data after a period of time.  For example, in the case of a user who has not logged on six months, it probably would not make much sense to the user to return to the long-forgotten view state he/she left six months before.  Also you don't want to bloat your DB by forever maintaining state data for users who never return to your site -- in this case you'd periodically run a routine to purge "expired" data from your DB table.

-mamlin


esmamlin atxgeek.me
 
New Post
12/3/2008 10:49 PM
 

Both very good points by Will and Mamlin.  I tend to forget the fourth option (as evidenced by my post) because I tend to steer clear of it wherever possible.  I am one of those purists (whether a good thing or not) and hate to bloat my pages with extra stuff that may or may not need to be on there depending on what the user ends up doing.  I really like MSAJAX because it is "easy", but oh how I hate it because it still posts back everything on its Callbacks. 

Completely off topic for managing state but related to the AJAX thing brought up -- I just completed a project that has a single .aspx page (yeah, not a DNN module though I *could* have done it as one).  All the content is stored as HTML snippets in several HTML files, then I use AJAX and jQuery to dynamically populate each section as it is accessed and completely replace the content from the previous section.  In other words I have a single placeholder DIV that I load the new "sections" into as they are requested and use jQuery to make the transition beautiful and smooth.  Then all the data is accessed via webservices using the MSAJAX framework (though I suppose I could just as easily do it with jQuery and reduce on javascript bloat... on the other hand, I'm using the scriptmanager to combine the scripts into a single request anyway so after initial request it is all cached anyway).  Long story short though, it is BEAUTIFUL and works GREAT.  Nothing like little 200 byte to a max of 2kb requests to handle everything.  Booyah!

mamlin wrote

 William Severance wrote
A fourth option is to use only one control with the appropriate mechanism (Panels, MultiView, ListView/DetailsView control, etc.) to hide the list/reveal the detail, etc. without having to redirect from control to control. With this approach, v13wstat3 will be available for maintaining page state...

This "fourth option" that William stated is what I tend to do.  I like to employ AJAX to retrieve detail data and, unless a more complex UI is demanded, do simple hide/show of data using javascript and DIVs. 


DB-Based State Storage and Timestamps

As stated by Fooberichu, you can keep track of view state by storing state info in a DB table.  To this I'd add that it can be a very nice thing to include a timestamp with the stored state info so you can chose to "expire" the data after a period of time.  For example, in the case of a user who has not logged on six months, it probably would not make much sense to the user to return to the long-forgotten view state he/she left six months before.  Also you don't want to bloat your DB by forever maintaining state data for users who never return to your site -- in this case you'd periodically run a routine to purge "expired" data from your DB table.

-mamlin


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Maintaining state between two user controlsMaintaining state between two user controls


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out