[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I add a value to URL?

Posted on 2009-04-22
3
Medium Priority
?
170 Views
Last Modified: 2012-05-06
This has to be simple, but I can't get it to work.

I have a page that I need to add the startDate and endDate text fields to the URL when the submit button is pressed.

Basicly:
...\mypage.aspx
After:
...\mypage.aspx?startDate=3/1/2009&endDate=3/31/2009

Without a redirect, I need it done via postback.

I want the submit button to postback to the page, and put the values in the URL.

Any ideas?
0
Comment
Question by:Meps
  • 2
3 Comments
 
LVL 14

Expert Comment

by:GiftsonDJohn
ID: 24206814
QueryString is a readonly property collection. If you want to do it without postback then you have to use

Server.Transfer("mypage.aspx?startDate=3/1/2009&endDate=3/31/2009");

in your code to have the form value persistent along with the query string during button click.
0
 
LVL 3

Author Comment

by:Meps
ID: 24206855
That's the problem, this is part of a big form.

If I do any sort of transfer or redirect, it will erase all the values in the form.

Which is why I just wanted it to postback.
0
 
LVL 3

Accepted Solution

by:
Meps earned 0 total points
ID: 24278331
I found this wasn't possible, every time you change the querystring, APS.Net sees it as a new page and changes viewstate and changes postback.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question