Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

ASP.Net Postback question

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
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

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.
Avatar of mainrotor
mainrotor

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
tgerbert
Thanks for the quick response.  Let me cleanup my code a little and then I will post it.  

mainrotor