我想为我的 panel 创建 OnClick 事件.到目前为止,大多数谷歌搜索结果或多或少是这样的:将 onclick 事件添加到 aspnet 标签.有没有办法从 javascript 或面板属性调用代码隐藏函数?因为我想将用户重定向到一个新页面,然后在 ViewSTate 或 Sessionstate 中保存一些信息.有什么建议?
i would like to create OnClick event for my panel. So far now the most of the google results look more or less like this: adding onclick event to aspnet label. Is there any way, to call codebehind function from javascript or panel attributes? Because I would like to Redirect user to a new page and before that save some information in ViewSTate or Sessionstate. Any suggestions?
在您的 java 脚本方法中引发 __dopostback 调用到 服务器端方法.
In your java script method raise a __dopostback call to a Server side method.
<script type="text/javascript">
function YourFunction()
{
__doPostBack('btnTemp', '')
}
</script>
其中btnTemp是一个服务器端的按钮,所以在服务器端写一个这个按钮的onClick事件,你可以在那里进行处理,然后重定向到其他页面.
Where btnTemp is a server side button, so write a onClick event of this button on server side, where you can do the processing and then redirect to other page.
您可以在 DoPostBack 理解
这篇关于将 OnClick 事件添加到 ASP.NET 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
车牌检测有哪些好的算法?What are good algorithms for vehicle license plate detection?(车牌检测有哪些好的算法?)
Unity中图像的onClick事件onClick event for Image in Unity(Unity中图像的onClick事件)
运行总 C#Running Total C#(运行总 C#)
单击带有 JAvascript.ASP.NET C# 的超链接时删除目录Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(单击带有 JAvascript.ASP.NET C# 的超链接时删除目录)
asp.net listview 在单击时突出显示行asp.net listview highlight row on click(asp.net listview 在单击时突出显示行)
从函数调用按钮 OnClickCalling A Button OnClick from a function(从函数调用按钮 OnClick)