Solved

VB.net Query String

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now