如何获取html文本框值到asp.net文本框? [英] How to get html textbox value to asp.net textbox?

查看:304
本文介绍了如何获取html文本框值到asp.net文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将html文本框值传递给asp.net文本框,以及如何将其保存在mysql数据库上?
下面的代码用于html文本框和按钮,我需要将此文本框值保存到mysql数据库

How to pass html textbox value to asp.net textbox and how to save it on mysql database????

below code is for html textbox and button i need to save this textbox value to mysql database

<input type="visible" name="amount" value="" />
<input type="image" name="submit" 

                            src="http://images.paypal.com/images/x-click-butcc.gif" border="0" 

                            alt="Make payments with PayPal, it's fast, free, and secure!" 

                            style="width: 147px; height: 52px;" />


在这里,我需要将html文本框的值传递给asp.net文本框,然后使用ap.net按钮单击我需要将文本框的值保存到数据库.以下代码是asp.net文本框....


here i need to pass html textbox value to asp.net textbox and using ap.net button click i need to save the textbox value to database..below code is asp.net textbox....

<asp:TextBox ID="TextBox49" runat="server">
<asp:Button ID="Button17" runat="server" Text="Button" />

推荐答案

如果您在html页面中使用html文本和按钮,则您应该尝试这样;

if u r using html text and button inside aspx page then u should try like this ;

<input id="customerPhone" name="customerPhone" type="Text" />
<button OnServerClick=" Btn_Click" runat="server" id="Button1" />



//在.cs代码中编写



// In .cs code write

protected void Btn_Click(object sender, EventArgs e)
 {
     string n = String.Format("{0}", Request.Form["customerPhone"]);

 }


在您的html文本中添加runat ="server"并分配htmltextbox.value = textbox.text;

在html标记中添加runat ="server"时,可以在代码隐藏页上访问该标记.
要访问html文本框值,您必须编写htmltextbox.value =";
add runat="server" in your html text and assign htmltextbox.value=textbox.text;

when you add runat="server" in html tag, You can access that tag on codebehind page.
to accesss html textbox value you have to write htmltextbox.value="";


您能解释一下何时要在asp.net文本中获取html文本值吗?
can u explain when u want to get html text value in asp.net text ?


这篇关于如何获取html文本框值到asp.net文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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