Okay, I've searched EVERYWHERE for this, and I am still confused. Saw a few posts here about it, but again, still confused...
I am creating a dynamic HTML table, from a database table. In the database table, I have cell properties for the HTML Table (Rowspan, colspan, color, etc). I need to be able to fill in these cells with the information I need. I had this running in ASP, but .NET is quite different...
I've decided to create the table, and use placeholders in each cell. Then in the Page_Load event, populate those placeholders with the necessary info. Now, in order to keep the ID's straight, I need to dynamically assign ID's when I create the PlaceHolder. I am doing it by this..
myReader is a datareader and has the Unique ID I am assigning to the Placeholder. Then in my code, I am trying to place a list box in each place holder, like so
selBox is already defined as a DropDownList.
However, the FindControl returns Null, and doesn't find the PlaceHolders I dynamically created. What am doing wrong? Thanks in advance...
I am creating a dynamic HTML table, from a database table. In the database table, I have cell properties for the HTML Table (Rowspan, colspan, color, etc). I need to be able to fill in these cells with the information I need. I had this running in ASP, but .NET is quite different...
I've decided to create the table, and use placeholders in each cell. Then in the Page_Load event, populate those placeholders with the necessary info. Now, in order to keep the ID's straight, I need to dynamically assign ID's when I create the PlaceHolder. I am doing it by this..
Code:
dim plcHold as PlaceHolder
plcHold = new PlaceHolder()
plcHold.ID = "MainHold" & myReader("templateSpaceVar")
Page.controls.add(plcHold)
Code:
Page.findcontrol("MainHold"&dr("templateSpaceVar")).controls.add(selBox)
However, the FindControl returns Null, and doesn't find the PlaceHolders I dynamically created. What am doing wrong? Thanks in advance...