访问服务器端HTML控件

编程入门 行业动态 更新时间:2024-10-26 10:36:39
本文介绍了访问服务器端HTML控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

<ul><li id="Accomodation" runat="server" visible="false"> <a href="../searchaccommodation.aspx?">Accomm</a></li></ul>

我有此代码.现在在服务器端,我想比较此id(Accommodation)值并想要id,即Accommodation.visible = true; 实际上,我不想手动检查b.innertext.,因为我必须先检查100种不同的类型...所以想要在服务器端访问b值并将该值与某些字符串数组(例如str [])进行比较.然后

i have this code.now on server side i want to compare this id(Accommodation) value and want id i.e.Accommodation.visible=true; actually i dont want manually to check b.innertext.because i have to check then 100 of different types...so want that b value to be accessed on server side and compare that value with some string array say str[]. then

for(i=0;i<100;i++) { if(str[i]==b) { b.visible=true } }

b每次都会更改.

b will change every time

推荐答案

请重新编写该代码,这样才有意义.现在,Accommodation应该是一个可以在服务器端访问的变量.问题是什么? Please rewrite this so it makes sense. Accomodation should now be a variable you can access on the server side. What is the issue ?

您可以使用InnerText属性访问此id的值.然后对其应用条件,将visible属性设置为true,即 在页面上 You can access the value of this id using InnerText property. then apply condition on it set visible property to true i.e on page <ul runat="server" id="a"> <li id="b" runat="server" visible="false">Test</li> </ul>

在代码方面

on code side

if (b.InnerText == "Test") { b.Visible = true; b.InnerText = "Text"; }

希望你有这个主意.

hope u got the idea.

更多推荐

访问服务器端HTML控件

本文发布于:2023-11-22 23:39:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619357.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   服务器端   HTML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!