Solved

VB.net Query String

Posted on 2009-07-09
1
535 Views
Last Modified: 2012-05-07
I am having a problem with Query Strings in a ASP.net application VB.net.

Here is a simplified version of the scenario:

URL: MyPage.aspx?QuoteNumber=12345

1) A user navigates to the page using a hyperlink in an email.
2) The page loads and pulls up the Quote from the Query String (Quote Number = 12345). Code looks like this:
       
        Dim QryStringFound As Integer
        Dim QuoteNumber As Integer

        QryStringFound = 0
        QuoteNumber = 0

        QuoteNumber = Request.QueryString("QuoteNumber")

        If QuoteNumber > 0 Then

            QryStringFound = 1

        End If

        If QryStringFound = 1 Then

            Me.txtQuote.Text = QuoteNumber

            'This code loads the Quote information using the Quote Number in the textbox.
            QuoteDetails()

        End If
3) The user decides to look at another quote, but when the page relaods the Query String, QuoteNumber=12345 is still there so it pulls up Quote Number 12345 again.

How do I make the QueryString only execute the first time the page is loaded?
0
Comment
Question by:yonbret
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24818967
You can check if page is postBack like below in your PageLoad:
If Not Page.IsPostBack Then
    'This is first time the page is loaded
    'execute your code here
End If
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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