Solved

VB.net Query String

Posted on 2009-07-09
1
538 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 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