Home All Groups Group Topic Archive Search About

Custom HTML Control Tags - Lets Try Again :)

Author
10 Feb 2006 3:30 PM
Tarun Mistry
Hi all, firstly appologies for the earlier stupid post.

Ok, I am using a repeater to make a table. This will be used to allow the
user to select a particular object (the table displays the contents of an
ArrayList of objects).

I would like todo this by selecting a radio button applied on each row of my
repeater. Quick example below, the "o" = a radio button.

    | Name
----------
o | James
o | David
o | Bob

How do i make dynamic HTML controls? Or do i need to use manul HTML here?

I.e. i cant put the following code in my itemTemplate:

<asp:RadioButton ID="<% DataBinder.Eval(Container.DataItem, "NameID")%>"
runat="server" GroupName="objects" />

Any pointers would be appreciated!

Thanks,
Taz

Author
10 Feb 2006 4:20 PM
krishna.bitla
Hi Taz,

You can create and add the controls dyamically to your web application.
Use the below example.

Create a table and add the table to the form. Get the handle of the
table from code behind file. Add radio button control to the table
dymically

Assume hTable is the Name of the HtmlTable

Dim htmlRow as New HtmlRow
Dim htmlColumn as New HtmlColumn

Dim rdButton as New RadioButton
rdButton.ID = "ID"
rdButton.Value = "Value"

htmColumn.Controls.Add(rdButton)
htmlRow.Columns.Add(htmlColumn)
hTable.Rows.Add(htmlRow)

Bookmark and Share