从呼叫GridView的RowDeleting事件JavaScript函数 [英] Call Javascript function from Gridview RowDeleting event

查看:137
本文介绍了从呼叫GridView的RowDeleting事件JavaScript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从if条件调用JavaScript警报在gvLocations_RowDeleting部分的GridView中。

I need to call a javascript alert from an if condition inside a gridview in the gvLocations_RowDeleting section.

code是如下:

protected void gvLocations_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
    if (CheckIfLocationExists(ID) == true)
    {
        //need to call javascript function sendmessage() here?? 
    }
}

我在.aspx文件中的JavaScript函数如下:

I have a javascript function in the .aspx file as follows

<script type="text/javascript">
function sendmessage()
{
    alert("Area is associated with this location already");
}
</script>

我知道这是一个简单的举动,但出于某种原因,有麻烦林。有人能帮忙吗?提前致谢。堆栈溢出石头!

I know this is an easy move but for some reason Im having trouble. Can someone help? thanks in advance. Stack Overflow rocks!

推荐答案

其实我想通了。希望这将有助于下面有人else..Use的code,就像一个魅力。

Actually I figured it out. Hopefully this will help someone else..Use the code below, works like a charm..

Page.ClientScript.RegisterStartupScript(this.GetType(), "helloworldpopup", "alert('hello world');", true);

这篇关于从呼叫GridView的RowDeleting事件JavaScript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆