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>
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