PC Review


Reply
Thread Tools Rate Thread

How can I perform some form actions on a seperate page?

 
 
Peter Bremer
Guest
Posts: n/a
 
      31st May 2007
Hi all,

I've got a form which lists all members of a club, with checkboxes to
select them. The form offers functions to delete selected members,
send email, etc.

Now I want write some code to perform complex analyses on the selected
members. I'd prefer to keep this code seperated from the basic form
processing, opening a new page with the results.

How should I go about doing this? I have a whole line of buttons for
the functions, and one of them should open a new page, how do I do
that? And how do I get the selection information from the overview
page to the analysis page?

Thanks, Peter

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      31st May 2007
store the data in sesson, and do a redirect to the new page.

-- bruce (sqlwork.com)

Peter Bremer wrote:
> Hi all,
>
> I've got a form which lists all members of a club, with checkboxes to
> select them. The form offers functions to delete selected members,
> send email, etc.
>
> Now I want write some code to perform complex analyses on the selected
> members. I'd prefer to keep this code seperated from the basic form
> processing, opening a new page with the results.
>
> How should I go about doing this? I have a whole line of buttons for
> the functions, and one of them should open a new page, how do I do
> that? And how do I get the selection information from the overview
> page to the analysis page?
>
> Thanks, Peter
>

 
Reply With Quote
 
Dunc
Guest
Posts: n/a
 
      31st May 2007
Careful here - don't mistake server functionality (i.e. analysing the
members) with client functionality (i.e. opening a new browser
window).

I would suggest you use some javascript to create a querystring of the
members you wish to analyse, then use the onclick event of the button
to execute it. Note: you'll get a warning if the button is set as
runat="server" but if you run it like a normal HTML button, it'll work
fine.

Off the top of my head (so excuse any typos or syntactical errors)
something like:

<head>
<script type="text/javascript">
function AnalyseMembers() {
// Get an array of all Checkboxes of a certain name on the page
var cbArray = document.getElementsByName("chkUserID");

// get comma seperated list of all selected user IDs
for (var i = 0; i < cbArray.lenght; i+) {
if (cbArray[i].checked) {
qs += cbArray[i].value + ",";
}
}

// remove trailing comma
if (qs != '') {
qs = qs.subString(0, qs.length - 1)
}

window.open('analysemembers.aspx?UserList=' + qs);
}
</script>
</head>
<body>
<form>
<input type="button" name="btnAnalyseMembers" value="Analyse Members"
onclick="AnalyseMembers();" />
</form>
</body>


If you really want to run it as an asp button, you should do the
btnAnalyseMembers.Attributes.Add("onclick", "AnalyseMembers();"); in
your Page_Load -> !Page.IsPostBack

Hope that helps,

D

On 31 May, 14:30, Peter Bremer <peter.bre...@gmail.com> wrote:
> Hi all,
>
> I've got a form which lists all members of a club, with checkboxes to
> select them. The form offers functions to delete selected members,
> send email, etc.
>
> Now I want write some code to perform complex analyses on the selected
> members. I'd prefer to keep this code seperated from the basic form
> processing, opening a new page with the results.
>
> How should I go about doing this? I have a whole line of buttons for
> the functions, and one of them should open a new page, how do I do
> that? And how do I get the selection information from the overview
> page to the analysis page?
>
> Thanks, Peter



 
Reply With Quote
 
Dunc
Guest
Posts: n/a
 
      31st May 2007
What if a user has more than one window open?

D

On 31 May, 16:09, bruce barker <nos...@nospam.com> wrote:
> store the data in sesson, and do a redirect to the new page.
>
> -- bruce (sqlwork.com)
>
>
>
> Peter Bremer wrote:
> > Hi all,

>
> > I've got a form which lists all members of a club, with checkboxes to
> > select them. The form offers functions to delete selected members,
> > send email, etc.

>
> > Now I want write some code to perform complex analyses on the selected
> > members. I'd prefer to keep this code seperated from the basic form
> > processing, opening a new page with the results.

>
> > How should I go about doing this? I have a whole line of buttons for
> > the functions, and one of them should open a new page, how do I do
> > that? And how do I get the selection information from the overview
> > page to the analysis page?

>
> > Thanks, Peter- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      31st May 2007
ASP.NET implements a new server-side page cache object, that has a
different life line than the session object. Using both, you can
persist data between pages for indefinite amounts of time, even if the
session object gets destroyed because of timeouts.

Assign each user a GUID (or any unique identifier) and store this
value in a session object with a well known key:

Session["USERGUID"]=new System.Guid(strUsersGUID)

then, you use the GUID to identify a particular page cache which holds
the data:

dim xmlDoc as XmlDocument=null
if not session["USERGUID"] is nothing then
dim strUserGUID as System.String=session["USERGUID"] 'get the key
to access the page cache
dim xml as System.String = Page.Cache[strUserGUID].ToString()
'retrieve your data from the page cache
XmlDocument.LoadXml(xml) 'instantiate your data
endif

before you unload your page, you can save your data in the page.cache
(and optionally destroy the session object):

Page.Cache[strUserGUID]=xmlDoc.OuterXml 'save your data to the page
cache
session["USERGUID"]=null 'destroying the session still preserves your
page cache
response.redirect("newpage.aspx")

and have the new page repeat the steps to get the page.cache in its
page_load function.

The page.cache persists using a different timer than the session
object, and if you re-establish the session you can get a reference to
an existing page cache. So, you can set the session to timeout in 5
minutes of inactivity and have the page cache timeout after one hour
of inactivity. The page cache cannot be accessed without the key in
the session object, so the session object provides security against
the user being inattentive and the page cache provides a mechanisim to
preserve the data between pages regardless of how long transmission
takes or the time between transations.

B.T.W. You don't have to use an XML document to store data in the page
cache, but it sure makes it easier to store and deliniate an arbitrary
number of fields simultaneously without passing them around in posts
or the hidden viewstate field in ASP.NET

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perform actions when email is sent Jon Kruger Microsoft Outlook Program Addins 1 30th Jul 2009 08:35 PM
Code to Look for Text and then Perform Specified Actions SeventhFloorProfessor Microsoft Excel Misc 1 6th Feb 2009 03:14 PM
How to perform two actions ? morph000 Microsoft Excel Worksheet Functions 5 22nd Jan 2006 02:13 AM
How can I get FP forms to perform TWO actions? =?Utf-8?B?RHJEcmFnb24=?= Microsoft Frontpage 2 31st May 2005 10:33 AM
perform multiple actions in an IF =?Utf-8?B?R2l4eGVyX0pfOTc=?= Microsoft Excel Programming 7 6th May 2005 02:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:26 PM.