Hi all. I am having some major issues here, and there has to be a solution out there.
I have a page, that is dynamically created from database entries. I create 3 select boxes and two text boxes for each row in the database. I do this through a loop, create new controls, set the properties, and then add the generated controls to a placeholder.
Depending on what someone selects in one of the select boxes, I will hide or show certain controls. Now, I have this working fine with a SelectedIndexChanged event and an AutoPostBack. However, since all of my controls are dynamic, when I postback, I have to recreate them all. So basically, this takes a minute or two to reload everything.
I know I can do this with Javascript, and I have a function to do this. However, I can't seem to attach a javascript function to a dynamic control. I have similar things working with static controls, so I assume it has something to do with the dynamic part of the controls. It doesn't seem to work. Am I misssing something?
Thanks in advance
I have a page, that is dynamically created from database entries. I create 3 select boxes and two text boxes for each row in the database. I do this through a loop, create new controls, set the properties, and then add the generated controls to a placeholder.
Depending on what someone selects in one of the select boxes, I will hide or show certain controls. Now, I have this working fine with a SelectedIndexChanged event and an AutoPostBack. However, since all of my controls are dynamic, when I postback, I have to recreate them all. So basically, this takes a minute or two to reload everything.
I know I can do this with Javascript, and I have a function to do this. However, I can't seem to attach a javascript function to a dynamic control. I have similar things working with static controls, so I assume it has something to do with the dynamic part of the controls. It doesn't seem to work. Am I misssing something?
Code:
selBox = new DropDownList();
selBox.ID = string.Concat( "dd", dr.TemplSpaceVar );
selBox.Attributes.Add( "runat", "server" );
selBox.Attributes.Add( "onchange", "viewTemplate('"+dr.TemplSpaceVar+"');" );
Thanks in advance