带有aps.net的html标签 [英] html tags with aps.net

查看:73
本文介绍了带有aps.net的html标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我上了一个aspx页面,但是我想使用html而不是asp的控件,这意味着我使用了输入类型的文本字段,并且要将该字段与vale ex:-
一起放入变量值

 <  输入   类型  ="    名称  ="      ="  / >  


在上面带有值的代码中,我不想在这里固定文本,我想通过一个变量来赋值.请为此提供适当的解决方案.

解决方案

VariableName在后面的代码中定义

<输入类型= "  name = "   =  <%= VariableName%>"/> 


使用为HTML控件分配值的Javascript

请使用以下任意一项.

 getElementById(" );
getElementByName(" );




对于示例代码,您可以像这样分配值

document.getelementbyname(''T1'')="def";



谢谢

SP


在输入标签中包含"id",并使用runat ="server"来访问
控制并分配值

<输入id = "  type = "  name = "   = " " runat =  服务器"/> 




后面的C#代码

  var  data = " 

 .T1. = data; 


Hello,
I took a aspx page but i want to use the controls of html not asp that means i used input type text field and with that field i want to put value of a variable with vale ex:-

<input type="hidden" name= "T1" value="abc"/>


in above code with value i don''t want to fix the text here i want to assign the value by a variable . Please give the appropriate solution for it.

解决方案

VariableName is define in code code behind

<input type="hidden" name= "T1" value="<%=VariableName%>"/>


Use Javascript to assign values to html controles

Use any one of the below.

 getElementById("element_id");
getElementByName("element_name");




For your sample code, you can assign value like this

document.getelementbyname(''T1'')="def";



Thanks

SP


Include "id" to your input tags and and runat="server" for you to access the
controls and assign a value

<input id="T1" type="hidden" name= "T1" value=""  runat="server" />




C# Code behind

var data = "sample"

this.T1.value= data;


这篇关于带有aps.net的html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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