• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

How do I add a value to URL?

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
Meps
Asked:
Meps
  • 2
1 Solution
 
GiftsonDJohnCommented:
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
 
MepsAuthor Commented:
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
 
MepsAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now