具有母版页失败的Asp.net Web表单从HTML获取用户输入 [英] Asp.net web forms with master page fail get user input from HTML
本文介绍了具有母版页失败的Asp.net Web表单从HTML获取用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:TextBox runat="server" ID="title"></asp:TextBox>
string input_title = title.text;
当我提醒input_title时,它是空的。为什么?
我尝试了什么:
if(Request.Params [input_title]!= null)r_title = Request.Params [input_title];
此方法也无法获得用户输入。
when i alert the input_title ,its empty.why?
What I have tried:
if (Request.Params["input_title"] != null) r_title = Request.Params["input_title"];
this method also fail get user input.
解决方案
如果您的
<asp:TextBox runat="server" ID="title"></asp:TextBox>
在Master Page中,您可以访问master中cs文件(代码隐藏)中的数据。
示例:title.Text
否则你可以通过javascript或jquery访问它
使用Jquery
is in Master Page, you can access data in cs file (code behind) of master.
Example : title.Text
Otherwise you can access it via javascript or jquery
Using Jquery
('#textboxId')。val()
使用Javascript
document.getElementById(textboxId)。value
('#textboxId').val()
Using Javascript
document.getElementById("textboxId").value
这篇关于具有母版页失败的Asp.net Web表单从HTML获取用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文