从后面的asp.net代码调用输入文本框值 [英] call the input textbox value from the asp.net code behind

查看:91
本文介绍了从后面的asp.net代码调用输入文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在后面的代码中获取输入文本框值而不使用ajax

解决方案

我可以在后面的代码中获取输入文本框值而不使用ajax

如果添加属性runat& id到您的输入,然后您可以在后面的代码中访问它而不使用Ajax。

Ex:

 <  输入    type   =  text    id   =  myInput    runat   =  server    /  >  


使输入文本框为

 runat =   server 


尝试使用这个来访问文件背后代码的HTML控件

<输入典型e =   text id =   txtId runat =   server / > 



要触发onkeypress事件,你可以从codebehind文件调用你的javascript函数。

你可以参考这个


can i get input textbox value in the code behind without using ajax

解决方案

can i get input textbox value in the code behind without using ajax
If you add attribute "runat" & "id" to your input then you can access it in your code behind without using Ajax.
Ex:

<input type="text" id="myInput" runat="server" />


make the input textbox to

runat="server"


Try this one to access your HTML controls on code behind file

<input type="text" id="txtId" runat="server" />


To fire onkeypress event you can call your javascript function from codebehind file.
you can refer this


这篇关于从后面的asp.net代码调用输入文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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