按钮单击事件不触发asp.net [英] button click event not firing asp.net

查看:72
本文介绍了按钮单击事件不触发asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我的代码如下,我已经声明了getscript函数打开display.aspx页面作为窗口。问题是当我点击按钮时它不会触发按钮的点击事件并完成剩下的工作。我想触发Button1的click事件。我怎样才能实现它?

注意:它有效几次



Hi guys
I have code like below and I have declared the getscript function to open the display.aspx page as a window. The problem is when I click on the button it doesn't fires the click event of the button and do the rest. I want to fire the click event of the Button1. How can I achieve it?
Note : It works some times

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

    Dim _scriptJS1 As String = GetScript("display.aspx", "NascarMap", True, False, False, False, False, False, False, False)
    Button1.Attributes.Add("onclick", _scriptJS1)

推荐答案

Hi


请试试这个



更改 导致验证 属性特定按钮





原因验证=false
Hi
please try this

change the causes validation property of that particular button


Causes Validation = "false"


你好



我解决了自己,我需要把返回true ,如下所示强制回发



Hi

I solved myself, I need to put return true as below to force postback

Button1.Attributes.Add("onclick", _scriptJS1 + ";  return true;")


如果它有时有效,那么窗口可能已在后台打开(从你第一次打开)并再次打开它只会加载页面,但不会把它带到前面。
If it works sometimes, then it is possible that the window is already opened in the background (from the first time you open) and opening it again will just load the page but without bringing it to the front.


这篇关于按钮单击事件不触发asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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