Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2006

Tip: Looking for answers? Try searching our database.

How set query arg and navigate to new  page when button pressed?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Sutton - 14 Sep 2006 18:11 GMT
<Newbie>

How can I get arguments, and build a query URL, before a button is pressed?

I have a text box to enter a serial number.  When the search button is
pressed, I wish append the serial number text to the URL and navigate to
the search results page.  I tried the button click event, but this does
not work until the second click.  What is a better way to accomplish the
desired behavior?

private const string urlQuery = @"~/queryPage.aspx?serialNumber=";

protected void btnQuery_Click(object sender, EventArgs e)
{
   btnQuery.PostBackUrl = urlQuery + txtSerialNumber.Text;
}

Thanks in advance for any tips or suggestions,

-Ed
Cowboy (Gregory A.  Beamer) - 15 Sep 2006 01:12 GMT
If you want to do this prior to postback, you need some javascript. You can
set up the textbox in question (or button) with additional attributes and
then emit the javascript, if you feel uncomfortable working in the client
world, but that is the only way to automagically redirect someone without a
postback.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************

> <Newbie>
>
[quoted text clipped - 17 lines]
>
> -Ed

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.