removing query string items from url?

J

jobs

I have a gridview with data that's a link to another page.

I want to pass search information to the called page, but I don't want
that query string to remain in the address line beyond the initial
call.

Say my like looks like this, mypage.aspx?search="whatever"

should my users make a selection on the page or even refresh, I want
the ?search to go away.. what's the best way to address this

without forcing a response redirect?

Thanks for any help or information.
 
G

Guest

I have a gridview with data that's a link to another page.

I want to pass search information to the called page, but I don't want
that query string to remain in the address line beyond the initial
call.

Say my like looks like this, mypage.aspx?search="whatever"

should my users make a selection on the page or even refresh, I want
the ?search to go away.. what's the best way to address this

without forcing a response redirect?

Thanks for any help or information.

Maybe you can use HTTP POST instead of GET method? In this case you
can call mypage.aspx without using querystring...

Example:

<form action="mypage.aspx" method="post">
<input type="text" name="search" value="whatever" />
<input type="submit" value="search" />
</form>
 
J

jobs

<form action="mypage.aspx" method="post">
<input type="text" name="search" value="whatever" />
<input type="submit" value="search" />
</form>

Thanks for that.. thinking about how this will work and what the
impact might be.

the hyperlink is inside a gridview on content page. The form, is on
the master page and will control many pages and controls. I'm not sure
how I would even set the id search to whatever from the gridview.

thank you.
 
G

Guest

Thanks for that.. thinking about how this will work and what the
impact might be.

the hyperlink is inside a gridview on content page. The form, is on
the master page and will control many pages and controls. I'm not sure
how I would even set the id search to whatever from the gridview.

thank you.

Well, what about a LinkButton Control instead of normal hyperlink?
The LinkButton posts the web form back.

in the grid

<asp:LinkButton
ID="Button1"
CommandArgument="whatever"
Text="Search">
runat="server" />

in the code-behind

protected void EditContent(object sender, CommandEventArgs e)
{
//e.g. use Session
Session["search"] = e.CommandArgument.ToString();
Response.Redirect("~/mypage.aspx");
}

OR there is also another way to use the PostBackUrl property

<asp:LinkButton ID="Button1"
PostBackUrl="~/mypage.aspx"
runat="server"
Text="Search" />

to pass the value: http://msdn2.microsoft.com/en-us/library/ms178139(VS.80).aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top