[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP.Net Postback question

Posted on 2009-02-24
4
Medium Priority
?
425 Views
Last Modified: 2012-05-06
Hi all-
I have an ASP.Net application where a user enters some information into some text fields pressess button and a quote is returned to them.  
The first trip around the application works fine.  If the user changes some information in the fields and clicks on the button a second time, the quote is not recalculated.  Is there some setting in postback that I am not setting properly?  Any input would be greatly appreciated.

Thanks in advance,
mainrotor
0
Comment
Question by:mainrotor
  • 2
  • 2
4 Comments
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 23722819
That would depend on your code...

Normally you would use...

Sub Page_Load(...)
  If Not IsPostBack Then
    ... Do initial processing, e.g. set some text box values
  Else
    ... if it is a postback, do the calculations
  End If
End Sub


Post your code if you can.
0
 

Author Comment

by:mainrotor
ID: 23723680
tgerbert
I don't use:

Sub Page_Load(...)
  If Not IsPostBack Then
    ... Do initial processing, e.g. set some text box values
  Else
    ... if it is a postback, do the calculations
  End If
End Sub

because I populate my dropdownlist controls at design time using SQLDataSource objects.  For my button I just use my button_click event.  I have attached my button's on click event as a code snippet.

Thanks,
mainrotor  
    Protected Sub btnGetQuote_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetQuote.Click
        If ddlShimpentType.SelectedValue = "A" Then
            GetAirQuote()
        ElseIf ddlShimpentType.SelectedValue = "G" Then
            GetGroundQuote()
        End If
 
        cmdSave.Enabled = True
        cmdSave.Visible = True
        cmdNew.Enabled = True
        cmdNew.Visible = True
        Button2.Enabled = True
        Button2.Visible = True
        'cmdRerate.Enabled = True
        cmdRerate.Visible = True
        btnGetQuote.Visible = False
        btnGetQuote.Enabled = False
    End Sub

Open in new window

0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 1500 total points
ID: 23725148
Can you post the entire page's .aspx and .aspx.vb?

Nothing I see in your code above would explain what you're describing, but it could be code elsewhere on the page causing your grief (including Page_Load, or other controls' event handlers).

Initially I suspected Page_Load or some such thing was resetting what was selected in the drop down list...
0
 

Author Comment

by:mainrotor
ID: 23726182
tgerbert
Thanks for the quick response.  Let me cleanup my code a little and then I will post it.  

mainrotor
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

829 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