HTML链接&LT上点击呼叫时在ASP.NET中的C#功能; A> [英] Call a C# function in ASP.NET when clicking on a HTML link <a>

查看:246
本文介绍了HTML链接&LT上点击呼叫时在ASP.NET中的C#功能; A>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的ASP.NET所以原谅新手问题。

i'm new to asp.net so pardon the newbie question .

我有我的myEditPage.aspx页一些投入和一些文字区域,我希望他们上传到数据库,但这样做,我需要链接< A HREF =...&GT ; 在我myEditPage.aspx.cs功能

I have some inputs and some textareas in my myEditPage.aspx page and i wish to upload them to a database but to do so i need to link a <a href=".."> to a function in my myEditPage.aspx.cs .

我可怎么办呢?谢谢!

推荐答案

而不是

<a href=.....>

使用

<asp:LinkButton id="myid" runat="server" OnClick="MyFunction_Click" />

<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx\">LinkButton是一个ASP.Net服务器端控件

LinkButton is an ASP.Net server side control

当然,您可以将功能附加到&LT; A&GT; 标记为好。只是使它通过添加RUNAT =服务器给它的服务器控件。

Of course, you can attach a function to an <a> tag as well. Just make it a server control by adding runat=server to it.

<a href="#" runat="server" onServerClick="MyFuncion_Click" />

然后在你的函数检索您的文本域和投入的价值。

Then in your function retrieve the values of your textareas and inputs.

在一般情况下,使用asp.net的控制,而不是常规的HTML控件。这使得它更容易asp.net程序。

In general, use asp.net controls instead of regular html controls. It makes it easier to program asp.net.

有关的textarea /输入使用&LT; ASP:文本框&GT; 。如果你google了一下,你会发现很多教程,让你开始用asp.net编程。例如: http://www.asp.net/

For textarea/input use <asp:TextBox>. If you google a bit you will find many tutorials to get you started with asp.net programming. For example: http://www.asp.net/

这篇关于HTML链接&LT上点击呼叫时在ASP.NET中的C#功能; A&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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