如何从html按钮单击调用cs函数 [英] how to call cs funtion from html button click

查看:604
本文介绍了如何从html按钮单击调用cs函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

aspx文件:

.cs文件:

公共无效的display(){Response.Redirect("default.aspx"); }

如何从html按钮click.div调用.cs文件中的显示函数.解决方案

您可以使Html Button具有服务器Button Click事件.

在HTML按钮中使用它:

 onserverclick = "  


在cs文件中:

 受保护的 无效 HtmlButton_Clicked(对象发​​件人,EventArgs e)
{
  //  display(); 
} 


aspx file:

.cs file:

public void display() { Response.Redirect("default.aspx"); }

How to call the display function which is in .cs file from html button click

解决方案

You can have server Button Click event of the Html Button.

Use that for it in HTML button:

onserverclick="HtmlButton_Clicked"


In cs file:

protected void HtmlButton_Clicked(object sender, EventArgs e)
{
  //display();
}


这篇关于如何从html按钮单击调用cs函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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