如何调用函数 [英] How to call a function
本文介绍了如何调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在.cs文件中有一个C#函数.我在.aspx页面中有一个html按钮.单击按钮时,我必须调用该函数.我该怎么做?
I have a C# function in a .cs file. I have a html button in a .aspx page. I have to call that function when the button is clicked. How do I do that?
推荐答案
在设计视图中的页面上添加一个asp:Button.双击按钮. VS会为您在代码后面创建一个新事件.从此事件中调用您的函数.
如果确实必须使用html按钮,则添加ID
和runat=server
属性,并在代码中创建一个事件,从该事件中可以调用函数.
Add an asp:Button to the page in design view. Double-click the button. VS will create a new event in code behind for you. Call your function from this event.
If you really must use an html button then addID
andrunat=server
attributes and create an event in code behind from which to call your function.
这篇关于如何调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文