Solved

VB.net Query String

Posted on 2009-07-09
1
536 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

791 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