Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Page refresh

  Asked By: Caleb    Date: Jan 07    Category: Asp.net    Views: 877
  

I am having a problem when I perform an update to a page nothing on the page refreshes. I have to go out of the page and come back in to the page in order to process another record? What am I doing wrong.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Geraldine Perkins     Answered On: Jan 07

I suspect you are not rebinding the data on your update. In the
pageload you mostly are watching for the IsPostBack and not rebinding
the data on the postback, which is a good thing. I could give you an
example of this if you have included the code.

 
Answer #2    Answered By: Corey Jones     Answered On: Jan 07

Here is what I have got so far. Don't laught at my code I'm a beginner. I am welcome to any suggestions.


<script runat="server">
Dim MyConnect As SqlConnection
Sub Page_Load(Src As Object, E As EventArgs)
Lbl_Biller.text = session("UserCode")
Dim ConnectString As String
MyConnect = New SqlConnection
connectString = ConfigurationSettings.AppSettings("ConnectStr")
MyConnect.ConnectionString = ConnectString
If Not IsPostBack Then
BindGrid()
DropDown()
End If

End Sub

public Sub BindGrid()
Dim strSQL As String
Dim NewDate as String
Dim MyCommand As SqlDataAdapter = New SqlDataAdapter ("Select top 5 * " _
& "From vBillingQPatient where status= 3", MyConnect)
Dim BillingQDS As DataSet = New DataSet()
MyCommand.Fill(BillingQDS,"PatientInfo")
PatientInfoDataGrid.DataSource=BillingQDS
PatientInfoDataGrid.DataBind()
Dim Row1 as datarow = BillingQDS.tables("PatientInfo").Rows(0)
Dim Row2 as datarow = BillingQDS.tables("PatientInfo").Rows(1)
Lbl_BillingQID.Text = Row1("BillingQID").ToString()
Lbl_PatientName.text = Row1("PatientName").ToString()
Lbl_Priority.text = Row1("Priority").ToString()
Lbl_TodayStatus.text = Row1("Status").ToString()
Lbl_PatientAge.text = Row1("Age").ToString()
Lbl_DOS.text = Row1("ApptDate").ToString()
Lbl_ResponsParty.text = Row1("Guarantor1Name").ToString()
Lbl_PrimaryInsure.text = Row1("PayorName").ToString()
Lbl_SecInsure.text = Row1("PayorName").ToString()
Lbl_NextPatient.text = Row2("PatientName").ToString()
End Sub

Sub DropDown()
Dim oReader As SQLDataReader
MyConnect.Open()
Dim MyCommand = New SqlCommand("Select * From tBillingAction", MyConnect)
oReader = MyCommand.ExecuteReader()
BillingActionDropDown.DataSource= oReader
BillingActionDropDown.DataBind()
End Sub

Sub Save_Click(sender As Object, e As EventArgs)
Dim BillingQHistoryDS As DataSet = New DataSet
Dim BillingQHistoryCB As SqlCommandBuilder
Dim ConnectString As String
Dim Connect As SqlConnection = New SqlConnection
Dim Adapter As SqlDataAdapter = New SqlDataAdapter
Dim Row as DataRow
ConnectString = ConfigurationSettings.AppSettings("ConnectStr")
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = New SqlCommand("Select * from tBillingQHistory",Connect)
BillingQHistoryCB = New SqlCommandBuilder(Adapter)
Adapter.Fill(BillingQHistoryDS,"BQHistory")
Row = BillingQHistoryDS.Tables("BQHistory").NewRow
Row.Item("UserID") = Lbl_Biller.text
Row.Item("Date") = Format(Now,"d")
Row.Item("BillingAction") = BillingActionDropDown.selectedItem.Value
BillingQHistoryDS.Tables("BQHistory").Rows.Add(Row)
adapter.Update(BillingQHistoryDS, "BQHistory")
If BillingQHistoryDS.HasErrors Then
Lbl_Message.text = "There was an error inserting new Billing Action." & _
BillingQHistoryDS.Tables("BQHistory").Rows(0).RowError
End If
'Update Status
UpdatePatient()

End Sub

Sub UpdatePatient()
Dim BillingQDS As DataSet = New DataSet
Dim BillingQCB As SqlCommandBuilder
Dim ConnectString1 As String
Dim Connect1 As SqlConnection = New SqlConnection
Dim Adapter1 As SqlDataAdapter = New SqlDataAdapter
Dim Row1 as DataRow
ConnectString1 = ConfigurationSettings.AppSettings("ConnectStr")
Connect1.ConnectionString = ConnectString1
Adapter1.SelectCommand = New SqlCommand("Select * from tBillingQ where BillingQID =" & Lbl_BillingQID.text , Connect1)
BillingQCB = New SqlCommandBuilder(Adapter1)
Adapter1.Fill(BillingQDS,"BillingQ")
Row1 = BillingQDS.Tables("BillingQ").Rows(0)
Row1.Item("Status") = 1
Adapter1.Update(BillingQDS,"BillingQ")

If BillingQDS.HasErrors Then
Lbl_Message.text = "There was an error Updating this user account." & _
BillingQDS.Tables("BillingQ").Rows(0).RowError
End If
End Sub

Sub ActLog_Click(sender As Object, e As EventArgs)
Dim sScript as String
sScript = "<script language=JavaScript> "
sScript += "window.open('http://Griffster/pace/BillingActionLog.aspx', 'newWin','scrollbars=yes,status=no,width=700,height=400');<"
sScript += "/script>"

If ( Not IsClientScriptBlockRegistered("GotoActionLogScript")) Then
RegisterClientScriptBlock("GotoActionLogScript", sScript)
End If
End Sub
</script>

 
Didn't find what you were looking for? Find more on Page refresh Or get search suggestion and latest updates.




Tagged: