473,671 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5802
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 INamingContaine r
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("my radiobuttonid")

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:RadioButto n id="testid" Text="<%# Container.DataI tem["myfield"]%>"
GroupName="test groupname" runat="server"/>
</itemtemplate>
</asp:repeater>

?
Thanks
Matt

"london calling" <lo***********@ discussions.mic rosoft.com> wrote in message
news:29******** *************** ***********@mic rosoft.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 INamingContaine r
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("my radiobuttonid")

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 INamingContaine r 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 INamingContaine r
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("my radiobuttonid")

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 INamingContaine r.. 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:RadioButto n id="testid" Text="<%# Container.DataI tem["myfield"]%>"
GroupName="test groupname" runat="server"/>
</itemtemplate>
</asp:repeater>

?
Thanks
Matt

"london calling" <lo***********@ discussions.mic rosoft.com> wrote in message
news:29******** *************** ***********@mic rosoft.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 INamingContaine r
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("my radiobuttonid")

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.mic rosoft.com> wrote in message
news:12******** *************** ***********@mic rosoft.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 INamingContaine r 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 INamingContaine r
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("my radiobuttonid")

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
1902
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' + '<%# (string)DataBinder.Eval(Container.DataItem, "ParcelID") %>' + PropType1 I think part of the problem is that intially there is no data bound to this repeater section. The data doesn't get built until the user clicks a button on the form and then...
2
2448
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 achieve this I have done the following <asp:Repeater id='rep1' runat='server'> <HeaderTemplate> <table>
2
2934
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: "'<%#((OnlineLearningEnvironment.MultipleChoiceChoice)Container.DataItem).choiceText%>' is not a valid identifier." So, my question is, what do I do? (Code follows) Thank you in advance,
3
5674
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 htmlAnchor's ServerClick event (works when not inside a repeater), and a handler for the repeater's ItemCommand event. My html and vb source code is shown below, but what I think I need is a simple working example in vb.net. Can anyone help?...
7
6379
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 Place1 As New PlaceHolder Controls.Add(Place1) For y = 1 To Choices.RecordCount Choices.MoveTo(y)
8
3019
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 way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
0
4090
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 that my second repeater has the following error, System.NullReferenceException: Object reference not set to an instance of an object. When I put a watch on I can see my second repeater is not being created because it is equal to "Nothing". I can...
5
3844
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: ---------------------------------------------------------------------------------------------------------------------- | <a href="config.aspx?siteid=FIEJGIE">Site 1</a| Site 2 | <a href="config.aspx?siteid=DFOWEMF">Site 3</a>| In the example above site 2 is the "current" tab. I have the following code at the top of my...
4
5307
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 inside my repeater.. any suggestions? tnx
0
8472
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.