从asp.net网站的c#代码改变html控件的值 [英] changing value of html control from c# code in asp.net website

查看:108
本文介绍了从asp.net网站的c#代码改变html控件的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我如何从

c更改html控件的值#....

例如我有一个asp.net单选按钮控件和一个html隐藏

变量...

所以在页面加载以防单选按钮被选中我要设置这个

隐藏变量到1其他0 ...


我在Page_Load(对象发送者,

System.EventArgs e)函数中没有得到什么来改变值这个html

变量...

解决方案

嘿请回复,如果你有任何想法......它有点紧急......

saurabh写道:


任何人都可以告诉我如何从
c#....

例如我有一个asp.net单选按钮控件和一个html隐藏

变量...

所以页面加载如果选中单选按钮我想将这个

隐藏变量设置为1否则0 ...


我没有在Page_Load(对象发送者,

System.EventArgs e)函数中写入什么来改变这个html的值

变量...


我认为使用服务器控件可能更容易,否则对于

大部分服务器甚至不知道它存在。

根据您的需求可能是最好的解决方案。


即使你去了服务器重新创建html控件的路线<每次加载/回发时,
将需要尽可能多的服务器功率。因为它只需要使用服务器控件


" saurabh"写道:


任何人都可以告诉我如何从

c改变html控件的值#....

例如,我有一个asp.net单选按钮控件和一个html隐藏

变量...

所以页面加载,以防单选按钮被选中i想把这个

隐藏变量设置为1,否则0 ...


我没有得到用Page_Load写的东西(对象发送者,

System.EventArgs e)更改此html值的功能

变量...


< blockquote>

根据要求,在我的情况下这可能是不可能的....任何

身体都有以下任何一个想法:

1)检查服务器控制radiobutton是否检查,使用

javascript,每次加载页面....如果你知道告诉我所有步骤

需要采取。

2)或者从内部更改隐藏的html变量的值c#
我们在asp.net网站上写的
代码....

-----------------


Sean写道:


我认为使用服务器控件可能更容易,否则为

大多数情况下服务器甚至不知道它存在。

根据您的需求可能是最好的解决方案。


即使你走了让服务器在每次加载/回发时重新创建html控件

它将需要尽可能多的服务器power。因为它只需要使用服务器控件


" saurabh"写道:


任何人都可以告诉我如何从

c改变html控件的值#....

例如,我有一个asp.net单选按钮控件和一个html隐藏

变量...

所以页面加载,以防单选按钮被选中i想把这个

隐藏变量设置为1,否则0 ...


我没有得到用Page_Load写的东西(对象发送者,

System.EventArgs e)函数来改变这个html的值

变量......


Can anybody tell me how to change the value of an html control from the
c#....
eg i hv one asp.net radio button control and one html hidden
variable...
so on page load in case the radio button is checked i want to set this
hidden variable to 1 else 0...

I am not getting what to write in Page_Load(object sender,
System.EventArgs e) function to change the value of this html
variable...

解决方案

hey pls reply if u hv any idea...its kindaa urgent...
saurabh wrote:

Can anybody tell me how to change the value of an html control from the
c#....
eg i hv one asp.net radio button control and one html hidden
variable...
so on page load in case the radio button is checked i want to set this
hidden variable to 1 else 0...

I am not getting what to write in Page_Load(object sender,
System.EventArgs e) function to change the value of this html
variable...


I think it might be easier just to use a server control becuase otherwise for
the most part the server doesnt even know it exists.
Depending on your needs that might be the best solution.

even if you went the route of having the server re-create the html control
on each load/postback it would take as much server "power" as it would to
just use a server control

"saurabh" wrote:

Can anybody tell me how to change the value of an html control from the
c#....
eg i hv one asp.net radio button control and one html hidden
variable...
so on page load in case the radio button is checked i want to set this
hidden variable to 1 else 0...

I am not getting what to write in Page_Load(object sender,
System.EventArgs e) function to change the value of this html
variable...



as per requirments this might not be possible in my case....Does any
body has idea at any one of the following:
1) To check if a server control radiobutton checked or not , using the
javascript, each time page is loaded....If u know tell me wht all steps
need to be taken.
2) or to change the value of a hidden html variable from inside the c#
code that we write in asp.net website....
-----------------

Sean wrote:

I think it might be easier just to use a server control becuase otherwise for
the most part the server doesnt even know it exists.
Depending on your needs that might be the best solution.

even if you went the route of having the server re-create the html control
on each load/postback it would take as much server "power" as it would to
just use a server control

"saurabh" wrote:

Can anybody tell me how to change the value of an html control from the
c#....
eg i hv one asp.net radio button control and one html hidden
variable...
so on page load in case the radio button is checked i want to set this
hidden variable to 1 else 0...

I am not getting what to write in Page_Load(object sender,
System.EventArgs e) function to change the value of this html
variable...


这篇关于从asp.net网站的c#代码改变html控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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