警报脚本在asp.net中的Iframe代码中的grideview控件中不起作用 [英] alert script is not working in grideview control in Iframe tag in asp.net
本文介绍了警报脚本在asp.net中的Iframe代码中的grideview控件中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
警报脚本在gridview中不起作用(删除行绑定),我的代码在这里.预先感谢.
Alert script are not working in a gridview (delete rowbound) my code is here. Advance thanks.
Protected Sub Delete_onGridRow_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
ostate = New BLstate
str = DirectCast(sender, System.Web.UI.WebControls.ImageButton).CommandName.ToString
With ostate
.stateid = str
End With
result = state.state_delete(ostate)
If result > 0 Then
gvList.DataSource = state.Listview(txtstate.Text, ddstateStatus.SelectedValue)
gvList.DataBind()
'Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "alert", "alert('item not deleted');", True)
'Page.ClientScript.RegisterStartupScript(Me.GetType, "alert", "showDialog('Warning','Item not deleted.','warning');", True)
'Response.Write("item not deleted")
Response.Write("<script type=text/javascript>alert('item not deleted')</script>")
NoDataLabel.Text = "item not deleted"
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
推荐答案
如果您使用的是AJAX,则可以使用ScriptManager
You can use ScriptManager if you are using AJAX
ScriptManager.RegisterStartupScript(this,this.GetType(), DateTime.Now.Tostring(), "alert(''Hi'');",true);
谢谢
Vinod
Thanks
Vinod
尝试更改此行.
try by changing this line..
Response.Write("<script language='javascript'>alert('item not deleted');</script>")
希望它能正常工作.
hope it works..
在行下方更改
Response.Write(< script type = text/javascript> alert(``未删除项目'')</script>")
在下面的行
this.ClientScript.RegisterStartupScript(this.GetType(),%#######%","alert(" Hi);",true);
Change below line
Response.Write("<script type=text/javascript>alert(''item not deleted'')</script>")
with below line
this.ClientScript.RegisterStartupScript(this.GetType(), "%#######%", "alert(''Hi'');",true);
这篇关于警报脚本在asp.net中的Iframe代码中的grideview控件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文