for me I think, its better to create a custom control, which will render the candidate groups.
the control should have a DataSource like property, where you can assign the the list of candidates or the like.
adding controls to containers and other controls is simple just like what silentkill posted.
someObject.Controls.Add(<control here>);
but I'm sure that would not be enough to simplify your solution.
hmm decided to use listview na lang para mas dali...hehehe....follow up question how do you add image as a subitem of an item in listview?
^^
ItemTemplate
If I were you, I would make a web user control for this with properties (Image, Name, ID etc) and 1 event say delegate YouClickedMe(ID as Integer). Query the database normally and do a loop, instantiate your user control for each pass sa loop.
MyUserControl X = CType(this.LoadControl("VirtualPathOfYourControl") , ControlType)
X.Image = FromDatabase
X.Name = FromDatabase
X.ID = FromDatabase
Add the event handler sa imong delegate/event. I forgot the syntax in C# pero sa VB it is AddHandler X.YouClickedMe, AddressOf("EventHandler")
Add your instantiated user control to whatever is your control container, a repeater is good enough.
Last edited by Rainerius; 09-09-2011 at 12:08 AM.
Similar Threads |
|