且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取html文本框值到asp.net文本框?

更新时间:2022-05-17 03:07:11

如果您在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 ?