score:0
Maybe you could change your list to use the ASP listitem control, which would allow you to...
Try something like this. Using is to cast a control for testing is efficient.
foreach (Control c in Page.Controls)
{
if (c is ListItem)
{
//do something with the control
}
}
score:1
I tested this and added some <li>
's manually. I could get them to show up if I set runat="server"
in their tag. So the code you're using to generate and add the ListItems is not creating them with the runat.
Edit
You made need to consider using an actual ASP .NET Control such as a DataGrid or Repeater or BulletedList as MAW74656 suggested instead of HTML <ul>
's.
Source: stackoverflow.com
Related Query
- How to loop through controls to get specific type of controls?
- Using Linq to loop through all controls only get the first control
- How to query for specific type and then get underlying document
- How to loop through a child list of objects in Entity Framework 4.1 code first
- loop through specific attribute using xml linq and c# and get its lowest value
- How to loop through the properties of anonymous type in a list
- C# LINQ or for loop How to get a data source from a db?
- How to loop through an xml with similar elements names and different attributes to get value at each node?
- How to get specific element Count in XML or XElement variable
- Find all child controls of specific type using Enumerable.OfType<T>() or LINQ
- How to get the child declaring type from an expression?
- How to get Resharper to convert back to a foreach loop
- How to get only specific field from the list
- ASP.Net / C#, Loop through certain controls on a page?
- How do I get the value from a specific node in an XML file?
- LINQ and how to return a list of a specific type
- How to reflect types that have an interface of generic, and get that type of generic
- How to use MongoDB C# Driver Aggregate to get the latest item with specific values on 2 fields?
- How do I get property names of a type using a lambda expression and anonymous type?
- Avoid extra loop and could not find implementation of query pattern for source type int Select not found
- How to get a flattened list back to breezejs through webapi2?
- How to loop through var object collection in C#?
- How to get SQL query into LINQ form in C# code
- How can I loop Through all the elements in .select statement in Linq
- reading JSON data and loop through the data to get the certain value based on conditions
- How to find the index of first occurrence of a specific type of character after some substring?
- How to Loop through Datatable in Linq?
- How to query ManagementObjectCollection with LINQ, then loop through PropertyData for returned ManagementObject?
- How to get and use source of grouping in LINQ?
- Using linq to get list of web controls of certain type in a web page
More Query from same tag
- Getting nested XML attribute value using XmlDocument
- multiple orderby column of string by linq
- Linq Join using bit mask logic
- Multiple condition in LINQ where clause
- How to add add items near to next list
- getting Key from collection of KeyValuePairs
- Create TreeNodes with key in a Linq expression
- Using linq to return an object with a list<object> member
- Printing out nested anonymous types
- Help with this LINQ to SQL query
- Inefficient entity framework queries
- How to format your data on a record when using linq in sql asp.net mvc 5?
- LINQ DB Arithmetic must have common type (Date Comparison
- LINQ to XML - How to parse nested and complex xml using C#
- Basic Linq and order by
- I cant get the values from xml document
- How do I get all items in a list that are inside of another list?
- EF code first - getting DynamicProxies instead of objects. Why?
- Can I refer to a property in the current Select's object?
- What's the best practice for finding an object in a List based on one of object's properties?
- In LINQ to perform composed queries is it faster to call existing functions or write the whole query?
- TSQL How can I reuse a record in subqueries
- How to generate a LINQ query that queries all non-null properties from a search page model
- Best way to call an instance method in Expression Trees?
- Linq IEnumerable to entity cast error
- linq query where contains list of class
- Flatten a Dictionary<int, List<object>>
- Convert string[] to int[] in one line of code using LINQ
- C# - Linq cast generic list to custom class
- c# get info from query that existed or was created