本文介绍了上载到服务器时,消息框不起作用,但是在本地它起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我想显示当a=o比消息框显示消息时,如果删除不起作用的话.但是在本地可以,但是当它上传到服务器时,消息不起作用.

Here I want to show that when a=o than message box show the message, if not the delete is work. But Locally is all right but when it uploaded into server than message is not working.

Dim qu As String = "select [ReportType_ID] from [Report]"
            Dim da As SqlDataAdapter = New SqlDataAdapter(qu, conn)
            Dim dt As DataTable = New DataTable()
            da.Fill(dt)
            Dim start As Integer = 0
            Dim Endvalue As Integer = dt.Rows.Count - 1



            If (Endvalue >= 0) Then


                For value As Integer = start To Endvalue
                    Dim o As String
                    Dim a As String
                    'o = dt.Rows.Item(i).Item("ReportType_ID")
                    o = dt.Rows.Item(value).Item("ReportType_ID")

                    a = gvList.DataKeys(e.RowIndex).Value.ToString

                    If (a = o) Then
                        MessageBox.Show("Data Exist In Main Report! So, you can't delete from here.")
                        Response.Redirect("ReportType.aspx")
                        Exit For

                    End If

                Next value

'DELETE

                clsReportType.DeleteReportType(gvList.DataKeys(e.RowIndex).Value)
                Dim strJs As String = "<script>alert('Record Deleted Successfully..');</script>"
                ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(Page), "alert", strJs, False)
                ObjReportType.SelectCountMethod = "GetAllReportType"
                e.Cancel = True
            Else
               

            End If

        End Using

推荐答案

protected void Page_Load(object sender, EventArgs e)
   {
       const string someScript = "alertMe";
       if (!ClientScript.IsStartupScriptRegistered(this.GetType(), someScript))
       {
           ClientScript.RegisterStartupScript(this.GetType(),
               someScript, "alert('I was called from Content page!')", true);
       }
   }




这篇关于上载到服务器时,消息框不起作用,但是在本地它起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 21:38