Stop modalpopup closing on postback
Sunday 29 November 2009
By defauly a modalpopup automatically closes/hides on postback a simple solution to this is to simply set your postback even to show that modalpopup again by using the below code:
An example of this in use would be:
- Protected Sub btnAccessLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAccessLogin.Click
- Dim MyConnection As SqlConnection
- MyConnection = New SqlConnection()
- MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
-
- Dim strCode As String = txtAccessCode.Text.ToLower
- Dim sql As String = "SELECT * FROM CODES WHERE code = '" + strCode + "'"
-
- Dim resultsDataSet As New DataSet()
- Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(sql, MyConnection)
- myDataAdapter.Fill(resultsDataSet, "codes")
-
- If resultsDataSet.Tables("codes").Rows.Count = 0 Then
- lblAccessCode.Text = "Invalid access code, please try again:"
- lblAccessCode.ForeColor = Drawing.Color.Red
- PanelID.Show()
- Else
- lblAccessCode.Text = "The correct code was entered."
- End If
- End Sub
|
(0)
|
|
|