473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Radiobutton inside repeater with dynamic ID and text

Am I right in saying that you can't have a Radiobutton web control inside a
repeater bound to a database datasource and (inline) dynamically set it's ID
and text properties from the repeaters rows?
This is the impression I've got after extensive searching and trial and
error, even thought I have to say I find it hard to believe?
Thanks
Matt
Nov 19 '05 #1
5 5760
Hi Matt,

You may be able to dynamically set the radiobutton's id but i dont think it
would be very useful to you.

If you use the same id in the template, then by the INamingContainer
interface that the repeater implements, the ids will be unique on the client
side (if accessing them from script) and you can still find the control by
myRepeaterItem.FindControl("myradiobuttonid")

HTH jd

"Matt Jensen" wrote:
Am I right in saying that you can't have a Radiobutton web control inside a
repeater bound to a database datasource and (inline) dynamically set it's ID
and text properties from the repeaters rows?
This is the impression I've got after extensive searching and trial and
error, even thought I have to say I find it hard to believe?
Thanks
Matt

Nov 19 '05 #2
Ok, probably haven't explained it very well. Only wanted to do dynamic
labels to associate the HTML <label> tag with the correct radio button.

But ignoring the ID then for the moment (I actually also want to set the
'value' dynamically to, and which would have been better if I said that
instead of ID), how about dynamically setting the text?

E.g.
<asp:repeater ID="test" runat="server">
<itemtemplate>
<asp:RadioButton id="testid" Text="<%# Container.DataItem["myfield"]%>"
GroupName="testgroupname" runat="server"/>
</itemtemplate>
</asp:repeater>

?
Thanks
Matt

"london calling" <lo***********@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
Hi Matt,

You may be able to dynamically set the radiobutton's id but i dont think
it
would be very useful to you.

If you use the same id in the template, then by the INamingContainer
interface that the repeater implements, the ids will be unique on the
client
side (if accessing them from script) and you can still find the control by
myRepeaterItem.FindControl("myradiobuttonid")

HTH jd

"Matt Jensen" wrote:
Am I right in saying that you can't have a Radiobutton web control inside
a
repeater bound to a database datasource and (inline) dynamically set it's
ID
and text properties from the repeaters rows?
This is the impression I've got after extensive searching and trial and
error, even thought I have to say I find it hard to believe?
Thanks
Matt

Nov 19 '05 #3
Hi Matt, I have just done a little experiment... you can't set the
radiobutton's id but definately can set the text.

The "name" html attribute gets mangled by INamingContainer and the Value
gets set to the "ID".

So you would still have to loop through the repeater and inspect each radio
button to work out if it is checked and to find the text ... HTH jd

"london calling" wrote:
Hi Matt,

You may be able to dynamically set the radiobutton's id but i dont think it
would be very useful to you.

If you use the same id in the template, then by the INamingContainer
interface that the repeater implements, the ids will be unique on the client
side (if accessing them from script) and you can still find the control by
myRepeaterItem.FindControl("myradiobuttonid")

HTH jd

"Matt Jensen" wrote:
Am I right in saying that you can't have a Radiobutton web control inside a
repeater bound to a database datasource and (inline) dynamically set it's ID
and text properties from the repeaters rows?
This is the impression I've got after extensive searching and trial and
error, even thought I have to say I find it hard to believe?
Thanks
Matt

Nov 19 '05 #4
If you use an html radiobutton you may have less trouble, you could set any
attributes through databinding (<%# %> style) but if you don't set
runat="server" you won't have any mangling from INamingContainer.. just a
thought...

"Matt Jensen" wrote:
Ok, probably haven't explained it very well. Only wanted to do dynamic
labels to associate the HTML <label> tag with the correct radio button.

But ignoring the ID then for the moment (I actually also want to set the
'value' dynamically to, and which would have been better if I said that
instead of ID), how about dynamically setting the text?

E.g.
<asp:repeater ID="test" runat="server">
<itemtemplate>
<asp:RadioButton id="testid" Text="<%# Container.DataItem["myfield"]%>"
GroupName="testgroupname" runat="server"/>
</itemtemplate>
</asp:repeater>

?
Thanks
Matt

"london calling" <lo***********@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
Hi Matt,

You may be able to dynamically set the radiobutton's id but i dont think
it
would be very useful to you.

If you use the same id in the template, then by the INamingContainer
interface that the repeater implements, the ids will be unique on the
client
side (if accessing them from script) and you can still find the control by
myRepeaterItem.FindControl("myradiobuttonid")

HTH jd

"Matt Jensen" wrote:
Am I right in saying that you can't have a Radiobutton web control inside
a
repeater bound to a database datasource and (inline) dynamically set it's
ID
and text properties from the repeaters rows?
This is the impression I've got after extensive searching and trial and
error, even thought I have to say I find it hard to believe?
Thanks
Matt


Nov 19 '05 #5
Ok thanks jd, I'm probably going about it in the wrong way actually, still
thinking of it in terms of the classic ASP model of server/client
relationships, but currently I don't have time to worry about that....!
Looks like I'll just go with the basic HTML radio button element inside a
repeater (as you say)
Cheers
Matt

"london calling" <lo***********@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
Hi Matt, I have just done a little experiment... you can't set the
radiobutton's id but definately can set the text.

The "name" html attribute gets mangled by INamingContainer and the Value
gets set to the "ID".

So you would still have to loop through the repeater and inspect each
radio
button to work out if it is checked and to find the text ... HTH jd

"london calling" wrote:
Hi Matt,

You may be able to dynamically set the radiobutton's id but i dont think
it
would be very useful to you.

If you use the same id in the template, then by the INamingContainer
interface that the repeater implements, the ids will be unique on the
client
side (if accessing them from script) and you can still find the control
by
myRepeaterItem.FindControl("myradiobuttonid")

HTH jd

"Matt Jensen" wrote:
> Am I right in saying that you can't have a Radiobutton web control
> inside a
> repeater bound to a database datasource and (inline) dynamically set
> it's ID
> and text properties from the repeaters rows?
> This is the impression I've got after extensive searching and trial and
> error, even thought I have to say I find it hard to believe?
> Thanks
> Matt
>
>
>

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Holmes | last post by:
I am using radioButton controls in a data repeater and would like to incorporate the 'key' field into the 'id' attribute of the radioButton controls and name them something like: 'rad' + '<%#...
2
by: Abhishek Srivastava | last post by:
Hello All, I have bound an ArrayList to a repeater control. When the list is displayed, I want the the user to be able to choose one of the items in the list and then continue working. To...
2
by: Timothy V | last post by:
Hi, I have a RadioButton within a Repeater that i wish to assign an ID dynamically to the radiobutton. However, this won't allow me due to the following error:...
3
by: Leigh Webber | last post by:
I have an HTMLAnchor control on my aspx page. When it's not inside a repeater, it works fine. When I put it inside a repeater control, the handler never gets fired. I have a handler for the...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
5
by: Brad Baker | last post by:
I am trying to make a "tabbed" interface by iterating through a dataset with a conditional statement. For example: ...
4
ram09
by: ram09 | last post by:
i had a problem before where I cannot group my radiobuttons inside the repeater.. I found a fix for this problem in the net... my problem now is how to get the checked radiobutton in that group...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.