Click here to Skip to main content
16,019,618 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<ul><li id="Accomodation" runat="server" visible="false">
<a href="../searchaccommodation.aspx?">Accomm</a></li></ul>


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
C#
for(i=0;i<100;i++) 
{ 
    if(str[i]==b)
    {
        b.visible=true 
    }
} 

b will change every time
Posted
Updated 4-May-10 2:12am
v5

Please rewrite this so it makes sense. Accomodation should now be a variable you can access on the server side. What is the issue ?
 
Share this answer
 
Comments
tejasvee 4-May-10 7:25am    
basically i want to access id value on server side..
Accommodation is just one value..there are 100s of such ids..so i want that ids to access not manually
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
XML
<ul runat="server" id="a">
    <li id="b" runat="server" visible="false">Test</li>
    </ul>


on code side

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


hope u got the idea.
 
Share this answer
 
Comments
Christian Graus 4-May-10 7:00am    
How can this be what he means ? If it's a list item AND it's invisible, why would it's value change ?
tejasvee 4-May-10 7:21am    
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
}
now b will change every time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900