473,378 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Adding name-value pair to QueryString Collection?

Joe
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId) the first time that it is posted. After the user filles in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe
Feb 8 '06 #1
6 1767
Didn't understand.
When you call Response.Redirect, you says that a function that recreates
query string is called. Can't you place _formSessionId=something as a
parameter for next page?
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe

Feb 8 '06 #2
Joe
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redirect, you says that a function that recreates
query string is called. Can't you place _formSessionId=something as a
parameter for next page?
The function is called in the Button's click event when the form posts back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data for
the page. If it's not, I'll retrieve it from the database and add it to the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?
How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...
I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client Requirement.

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe


Feb 8 '06 #3
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your problem...
I would make a copy of Query String collection to a hashtable and then,
in the page load event, would check if the formSessionId variable is set or
not...
And I would use this Hashtable in the method that re-generates the query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redirect, you says that a function that recreates
query string is called. Can't you place _formSessionId=something as a
parameter for next page?


The function is called in the Button's click event when the form posts
back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data
for
the page. If it's not, I'll retrieve it from the database and add it to
the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?


How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...


I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client
Requirement.

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
> Hello All:
>
> I have a webform (WebForm1.aspx) that retrieves a value from a database
> (_formSessionId) the first time that it is posted. After the user
> filles
> in
> the form, he/she clicks a Button server control that ultimately
> redirects
> him/her to WebForm2.aspx [using
> Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
> re-creates the QueryString **)].
>
> I need to persist the value of _formSessionId between the initial post
> and
> the postback (after the Button control is clicked). I would like to
> add
> the
> value to the QueryString collection, since I will need the value in
> WebForm2.aspx. I, however, have found that the QueryString's NameValue
> collection is read-only.
>
> Does anyone know how I can do this? Is there a better way?
> --
> Joe


Feb 8 '06 #4
Joe
Hey Ravi.

One more question: is my only option to navigate to the next page
Response.Redirect or are there others ?
--
Joe
"Ravi Ambros Wallau" wrote:
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your problem...
I would make a copy of Query String collection to a hashtable and then,
in the page load event, would check if the formSessionId variable is set or
not...
And I would use this Hashtable in the method that re-generates the query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redirect, you says that a function that recreates
query string is called. Can't you place _formSessionId=something as a
parameter for next page?


The function is called in the Button's click event when the form posts
back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data
for
the page. If it's not, I'll retrieve it from the database and add it to
the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?


How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...


I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client
Requirement.

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
> Hello All:
>
> I have a webform (WebForm1.aspx) that retrieves a value from a database
> (_formSessionId) the first time that it is posted. After the user
> filles
> in
> the form, he/she clicks a Button server control that ultimately
> redirects
> him/her to WebForm2.aspx [using
> Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
> re-creates the QueryString **)].
>
> I need to persist the value of _formSessionId between the initial post
> and
> the postback (after the Button control is clicked). I would like to
> add
> the
> value to the QueryString collection, since I will need the value in
> WebForm2.aspx. I, however, have found that the QueryString's NameValue
> collection is read-only.
>
> Does anyone know how I can do this? Is there a better way?
> --
> Joe


Feb 8 '06 #5
Why not just concatenate it with the url, for instance
"Webform2.aspx?sessid=" + _formSessionId.

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe

Feb 8 '06 #6
You haver Server.Transfer as well...
Response.Redirect is processed in the browser;
Server.Transfer is processed at the server (the new page is processed and
the result of that page is passed to the browser, as it was the result of
the first page request) - it's faster, but I don't know if it's the best
choice (history, etc...)

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
Hey Ravi.

One more question: is my only option to navigate to the next page
Response.Redirect or are there others ?
--
Joe
"Ravi Ambros Wallau" wrote:
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your
problem...
I would make a copy of Query String collection to a hashtable and
then,
in the page load event, would check if the formSessionId variable is set
or
not...
And I would use this Hashtable in the method that re-generates the
query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
> Hi Ravi.
>
> Thanks for your response. Please see below. I would appreciate any
> more
> help that you can offer.
> --
> Joe
>
>
> "Ravi Ambros Wallau" wrote:
>
>> Didn't understand.
>> When you call Response.Redirect, you says that a function that
>> recreates
>> query string is called. Can't you place _formSessionId=something as a
>> parameter for next page?
>
> The function is called in the Button's click event when the form posts
> back
> to the server. I need it before the function is called. I need it in
> the
> page's Load event.
>
> Basically what I want to do is check the QueryString in the Load event
> for
> the FormSessionId key. If it's there, I'll use it to retrieve some
> data
> for
> the page. If it's not, I'll retrieve it from the database and add it
> to
> the
> QueryString's NameValue collection.
>
>> Can't you have a custom collection (that is a copy of the QueryString
>> collection) to do that, and is editable?
>
> How would you do this? More importantly, how would you make this
> custom
> collection the QueryString?
>
>> And, the better thing to do, why don't you use a Session to persist
>> data
>> between different posts? It's the better way to do this.
>> It will be automatically loaded when you get into there...
>
> I agree that Session would be best, but I can't use Session, Cache,
> ViewSatte, etc. I must use QueryString or hidden field. Client
> Requirement.
>
>>
>> "Joe" <Jo*@discussions.microsoft.com> wrote in message
>> news:CE**********************************@microsof t.com...
>> > Hello All:
>> >
>> > I have a webform (WebForm1.aspx) that retrieves a value from a
>> > database
>> > (_formSessionId) the first time that it is posted. After the user
>> > filles
>> > in
>> > the form, he/she clicks a Button server control that ultimately
>> > redirects
>> > him/her to WebForm2.aspx [using
>> > Response.Redirect(String.Concat("WebForm2.aspx?", **a function that
>> > re-creates the QueryString **)].
>> >
>> > I need to persist the value of _formSessionId between the initial
>> > post
>> > and
>> > the postback (after the Button control is clicked). I would like to
>> > add
>> > the
>> > value to the QueryString collection, since I will need the value in
>> > WebForm2.aspx. I, however, have found that the QueryString's
>> > NameValue
>> > collection is read-only.
>> >
>> > Does anyone know how I can do this? Is there a better way?
>> > --
>> > Joe
>>
>>
>>


Feb 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Iker Arizmendi | last post by:
Hello all. Is there a convenient scheme within a C extension to add methods to a type in such a way as to allow me to transparently add a "proxy" around them? For example: typedef PyObject*...
0
by: John Smith | last post by:
When the code below runs, I get the error: "cannot convert from 'System.Web.UI.WebControls.BoundField' to 'System.Web.UI.WebControls.DataGridColumn'" Is adding a BoundField different than adding...
2
by: David Williams | last post by:
I have a simple XML file that I have been using: <component name="test"> <class name="class"/> <component> Up till now, the Xpath of "//component/class" worked well to select the <class>...
3
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are:...
2
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling...
1
by: Asha | last post by:
Hello, below is a xml file which I’m working with. I want my result to be like this <group name="grp 4"> <report> <name>MTIS_1</name> </report> <report> <name>MTIS_1</name> </report />
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
4
by: glebur | last post by:
Hi, I'm trying to create a web service client in C# but I get stuck at one of the first steps. When adding a Web reference to the Visual Studio project; I get this error (this is a translation,...
4
by: thoseion | last post by:
Hi, I am trying to get a program working whereby directory and file names are read into a list. I have been given the original list structure - it appears that the directory names should be added...
3
by: raylopez99 | last post by:
Oh, I know, I should have provided complete code in console mode form. But for the rest of you (sorry Jon, just kidding) I have an example of why, once again, you must pick the correct entry point...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.