sweet_babylhyn
June 5th, 2009, 04:19 AM
Hello guys, I'm here again. After a few searched on google, I came out an idea on how to used pop up alert and I'm stuck again...
Protected Sub btnXML_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnXML.Click
dim participant_id as string
.
.
.
.
If Len(participant_id) = 0 Then
Me.PopupAlert("The user has no assigned participant")
Exit Sub
ElseIf Me.lstSeller.SelectedIndex = -1 Or Me.lstResource.SelectedIndex = -1 _
Or Me.lstBuyer.SelectedIndex = -1 Then
Me.PopupAlert("Check each filter values!...")
Exit Sub
ElseIfparticipant_id <> me.txtBCQBuyer.text Then
Me.PopupAlert("The values has changed, Reload the data...")
Me.ViewData()
End If
.
.
.
.
Response.ClearHeaders()
Response.AddHeader("content-disposition", "attachment;filename=tmp")
Response.ContentType = "xml"
Response.Write(tmpXML.OuterXml.ToString)
Response.Flush()
Response.Close()
End Sub
Public Sub PopupAlert(ByVal str As String)
Dim script As String
script = "<script type=text/javascript>alert('" + str + "');</script>"
Dim tmpPage As Page = HttpContext.Current.CurrentHandler
If Not tmpPage Is Nothing And Not tmpPage.ClientScript.IsClientScriptBlockRegistered("alert") Then
tmpPage.ClientScript.RegisterClientScriptBlock(Page.GetType, "alert", script)
End If
End Sub
Public Sub ViewData()
dim dt as new DataTable
.
.
.
.
Me.GridView.DataSource = dt
Me.GridView.DataBind()
End Sub
the first and second condition below works fine. It pop the alert window if its satisfy the condition.
If Len(participant_id) = 0 Then
Me.PopupAlert("The user has no assigned participant")
Exit Sub
ElseIf Me.lstSeller.SelectedIndex = -1 Or Me.lstResource.SelectedIndex = -1 _
Or Me.lstBuyer.SelectedIndex = -1 Then
Me.PopupAlert("Check each filter values!...")
Exit Sub
but the third condition below doesnt pop - up the alert window and the datagrid doesnt refresh even it satisfy the condition. I used to debug and it read the PopAlert and View Data but it did not show the alert and did not refresh also the datagrid. The last thing it do is download the XML. What do you think is the problem.... But when I used a MSGBOX, it came right but I think it will cause me a problem upon deployment if I will use it...
ElseIfparticipant_id <> me.txtBCQBuyer.text Then
Me.PopupAlert("The values has changed, Reload the data...")
Me.ViewData()
End If
Protected Sub btnXML_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnXML.Click
dim participant_id as string
.
.
.
.
If Len(participant_id) = 0 Then
Me.PopupAlert("The user has no assigned participant")
Exit Sub
ElseIf Me.lstSeller.SelectedIndex = -1 Or Me.lstResource.SelectedIndex = -1 _
Or Me.lstBuyer.SelectedIndex = -1 Then
Me.PopupAlert("Check each filter values!...")
Exit Sub
ElseIfparticipant_id <> me.txtBCQBuyer.text Then
Me.PopupAlert("The values has changed, Reload the data...")
Me.ViewData()
End If
.
.
.
.
Response.ClearHeaders()
Response.AddHeader("content-disposition", "attachment;filename=tmp")
Response.ContentType = "xml"
Response.Write(tmpXML.OuterXml.ToString)
Response.Flush()
Response.Close()
End Sub
Public Sub PopupAlert(ByVal str As String)
Dim script As String
script = "<script type=text/javascript>alert('" + str + "');</script>"
Dim tmpPage As Page = HttpContext.Current.CurrentHandler
If Not tmpPage Is Nothing And Not tmpPage.ClientScript.IsClientScriptBlockRegistered("alert") Then
tmpPage.ClientScript.RegisterClientScriptBlock(Page.GetType, "alert", script)
End If
End Sub
Public Sub ViewData()
dim dt as new DataTable
.
.
.
.
Me.GridView.DataSource = dt
Me.GridView.DataBind()
End Sub
the first and second condition below works fine. It pop the alert window if its satisfy the condition.
If Len(participant_id) = 0 Then
Me.PopupAlert("The user has no assigned participant")
Exit Sub
ElseIf Me.lstSeller.SelectedIndex = -1 Or Me.lstResource.SelectedIndex = -1 _
Or Me.lstBuyer.SelectedIndex = -1 Then
Me.PopupAlert("Check each filter values!...")
Exit Sub
but the third condition below doesnt pop - up the alert window and the datagrid doesnt refresh even it satisfy the condition. I used to debug and it read the PopAlert and View Data but it did not show the alert and did not refresh also the datagrid. The last thing it do is download the XML. What do you think is the problem.... But when I used a MSGBOX, it came right but I think it will cause me a problem upon deployment if I will use it...
ElseIfparticipant_id <> me.txtBCQBuyer.text Then
Me.PopupAlert("The values has changed, Reload the data...")
Me.ViewData()
End If