Question

I want to find dynamic controls. Example: - In my aspx:

<table id='vertragstypPVN_<%# Eval("Vertragstyp") %>' style="display: none" runat="server">

Table Ids will be generated like: vertragstypPVN_Test1, vertragstypPVN_Test2, etc.

  • In my aspx.cs, I want to find which table id is currenty using, but the method FindControl(string id) requires a static string id, I don't know how to deal with dynamic one. Any idea?. Many thanks
Was it helpful?

Solution

Since you generate the dynamic tables yourself, you already have a list of all the names that you have used. Use the Forms Collection to loop through all the tables and do a compare to hit to the right table.

OTHER TIPS

You must add runat="server" to your control and fix UniqueId of your control in order to find control

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top