473,769 Members | 6,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assign ID to a radiobutton inside a checkbox

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>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td>
<asp:RadioButto n Text='' Runat='server' Group='mygrp'
ID='<%# DataBinder.Eval (Container.Data Item, "Id")%>' />
</td>
<td>
<%#DataBinder.E val(Container.D ataItem, "Name")%>>
</td>
<tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>

But I get an error that <%#DataBinder.E val(Container.D ataItem, "ID")%>
is not a valid identifier.

Why can't I assign the ID dynamically?

Thanks for your help in advance.

regards,
Abhishek.
Nov 18 '05 #1
2 2453
You cannot dynamically set the ID of an ASP.NET control in an .aspx
file. Try to create the control dynamically and set the ID in the
code-behind.

For example, handle the OnItemDataBound event, and dynamically create
a radio button web control, set the ID property, and insert the
control to the Repeater.

Tommy,

Abhishek Srivastava <ab************ *****@nospam.ne t> wrote in message news:<uR******* *******@TK2MSFT NGP09.phx.gbl>. ..
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>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td>
<asp:RadioButto n Text='' Runat='server' Group='mygrp'
ID='<%# DataBinder.Eval (Container.Data Item, "Id")%>' />
</td>
<td>
<%#DataBinder.E val(Container.D ataItem, "Name")%>>
</td>
<tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>

But I get an error that <%#DataBinder.E val(Container.D ataItem, "ID")%>
is not a valid identifier.

Why can't I assign the ID dynamically?

Thanks for your help in advance.

regards,
Abhishek.

Nov 18 '05 #2
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Abhishek Srivastava" <ab************ *****@nospam.ne t> wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
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>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td>
<asp:RadioButto n Text='' Runat='server' Group='mygrp'
ID='<%# DataBinder.Eval (Container.Data Item, "Id")%>' />
</td>
<td>
<%#DataBinder.E val(Container.D ataItem, "Name")%>>
</td>
<tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>

But I get an error that <%#DataBinder.E val(Container.D ataItem, "ID")%>
is not a valid identifier.

Why can't I assign the ID dynamically?

Thanks for your help in advance.

regards,
Abhishek.

Nov 18 '05 #3

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

Similar topics

0
2108
by: Ashish Shridharan | last post by:
Hi All, Has anyone ever tried disabling a checkbox or a radiobutton web server control in netscape ? While a textbox and a button control renders disabled, .NET adds the disabled attribute to the span tag in the case of a checkbox or a radiobutton. Effectively, these controls are not disabled in netscape.
1
3590
by: rozrabiak | last post by:
Hi! I have problem witch Windows forms, CheckBox, RadioButton, ComboBox and database. How can I use checkbox (and other components) in database? I want to check the checkbox in My form and save changes in to database, but it return me an Exception: "Nothing changed", WHY? I'm using MSSQL MSDE.
2
3870
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb" Inherits="CustomerRelations.Testing" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>Testing</title> <!--
7
6398
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)
3
4440
by: newjazzharmony | last post by:
Hello group, I want to automatically select a specific checkbox when a user clicks (selects) a specific item in a radiobutton group. Both controls are in the same form. Let's say for argument's sake that the form looks like this (inessential items left out for the sake of clarity): <form name=form1>
5
1961
by: Web learner | last post by:
I have to have three RadioButtons and then under one of this RadioButton, I need to put two checkboxes. Something like following: O Temperature Air Water O Radiaton O Wind Velocity The child CheckBoxes (Air and Water in above example) should become
2
6610
by: Rich | last post by:
Hello, Is it possible to assign a value to a groupbox by selecting a radiobutton contained in the groupbox? Say you assign a value of 1 to radbtn1, 2 for radbtn2, 3 for radbtn3 all contained in grpBox. You click radbtn1. Console.writeline(grpBox.Value.ToString)
4
1610
by: Igor | last post by:
RadioButton have property Checked (true or false). If I make RadioButtons with code, without drawing by mouse than I have problems. I write like this: Dim rb(0 To 2) As RadioButton Dim n As Integer For n = 0 To 2 rb(n) = New RadioButton rb(n).Text = "Text: " + CStr(n)
0
1304
by: Nathan Sokalski | last post by:
In the RadioButton and CheckBox controls, there is no Value attribute. The html <inputtag has a value attribute, which is used by both type="radio" and type="checkbox". The RadioButtonList and CheckBoxList controls have SelectedValue properties (I realize that the RadioButtonList uses the <selectand <optiontags instead of the <inputtag, but needing a value server-side exists either way). I am attempting to write a control with...
0
9589
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
10049
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
9997
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
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
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.