View Full Version : How to add to the QueryString with Spring.Web
seamusmacfetridge
10-16-2006, 04:37 PM
Hi,
I am relatively new to Spring.Net and was wondering how you can add parameters to the Query String ?
The aspx page classes inherit from Spring.Web.UI.Page and we use the SetResult() method to control navigation throughout the site.
One of the web pages expects a parameter in Request.Params[]. How can I add this parameter in the codebehind of one page so that the second page can get it ?
Any help is really appreciated.
Thanks,
Seamus
Erich Eichinger
10-17-2006, 06:44 AM
Hi,
Just append the parameters to the url of your result:
<object type="ChannelEditor.aspx">
<property name="Results">
<dictionary>
<entry key="ChannelSelect"
value="redirect:ChannelEditor.aspx?cid=${IdChannelSelecte d}" />
</dictionary>
</property>
</object>
In this case, "IdChannelSelected" is a property of the ChannelEditor.aspx page and set to the right value just before calling SetResult():
class ChannelEditor : Spring.Web.UI.Page
{
....
public string IdChannelSelected { get { ... } set { ... } }
void OnSelectChannelClicked()
{
this.IdChannelSelected = <somechannel>
SetResult("ChannelSelect");
}
}
Cheers,
Erich
seamusmacfetridge
10-22-2006, 03:30 PM
Thanks for that.
That worked a treat. Would you have any idea how to add another parameter ? The following line seems to be give compilation errors
submit.aspx?jobref=${JobReference}&jobtitle=${JobTitle}
Thanks again,
Seamus
Erich Eichinger
10-22-2006, 11:19 PM
Hi,
you have to encode special xml-entities (&,<,>) in your config-file. Thus the line must read
<entry
key="ChannelSelect"
value="redirect:ChannelEditor.aspx?cid=${IdChannelSelecte d}&aid=${anotherid}" />
Cheers,
Erich
seamusmacfetridge
10-23-2006, 12:22 PM
Thats great. That worked for me.
Thanks for your help and time.
wmnelis
01-07-2011, 04:32 PM
This does not seem to work if you are using a PropertyPlaceholderConfigurer. Is there a way around this?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.