473,657 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validate Nested RadioButtonList

WB
Hi,

I have the following nested RadioButtonList in my web page that displays a
list of cities (categorized in states) for the user to select. There's a
RequiredFieldVa lidator to ensure user has selected one state.

<asp:RequiredFi eldValidator ID="VrqCity" runat="server" CssClass="error "
ErrorMessage="P lease select a city" ControlToValida te="RblCities" /><br />

<asp:Repeater ID="RptStates" runat="server"
OnItemDataBound ="GetBackPageTe mplates">
<ItemTemplate >

<strong><%# DataBinder.Eval (Container.Data Item,
"stateName").To String()%></strong>
<hr />

<asp:RadioButto nList ID="RblCities" runat="server"
RepeatDirection ="Horizontal " RepeatColumns=" 5" CssClass="text"
CellPadding="5" />

</ItemTemplate>
</asp:Repeater>

However, when the page is loaded, it shows the error:

Unable to find control id 'RblCities' referenced by the 'ControlToValid ate'
property of 'VrqCity'.

What's wrong?
ywb.
Feb 16 '06 #1
2 3161
HI,

In the code behind page check RadioButtonList is declared or not. Your code
should have

protected System.Web.UI.W ebControl.Radio ButtonList RblCities

Vinu

"WB" <WB@discussions .microsoft.com> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
Hi,

I have the following nested RadioButtonList in my web page that displays a
list of cities (categorized in states) for the user to select. There's a
RequiredFieldVa lidator to ensure user has selected one state.

<asp:RequiredFi eldValidator ID="VrqCity" runat="server" CssClass="error "
ErrorMessage="P lease select a city" ControlToValida te="RblCities" /><br />

<asp:Repeater ID="RptStates" runat="server"
OnItemDataBound ="GetBackPageTe mplates">
<ItemTemplate >

<strong><%# DataBinder.Eval (Container.Data Item,
"stateName").To String()%></strong>
<hr />

<asp:RadioButto nList ID="RblCities" runat="server"
RepeatDirection ="Horizontal " RepeatColumns=" 5" CssClass="text"
CellPadding="5" />

</ItemTemplate>
</asp:Repeater>

However, when the page is loaded, it shows the error:

Unable to find control id 'RblCities' referenced by the
'ControlToValid ate'
property of 'VrqCity'.

What's wrong?
ywb.

Feb 16 '06 #2
WB

The declaration is done by VS2005 in the partial class, and I can access
it's selectedValue etc in the code-behind.

"vinu" wrote:
HI,

In the code behind page check RadioButtonList is declared or not. Your code
should have

protected System.Web.UI.W ebControl.Radio ButtonList RblCities

Vinu

"WB" <WB@discussions .microsoft.com> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
Hi,

I have the following nested RadioButtonList in my web page that displays a
list of cities (categorized in states) for the user to select. There's a
RequiredFieldVa lidator to ensure user has selected one state.

<asp:RequiredFi eldValidator ID="VrqCity" runat="server" CssClass="error "
ErrorMessage="P lease select a city" ControlToValida te="RblCities" /><br />

<asp:Repeater ID="RptStates" runat="server"
OnItemDataBound ="GetBackPageTe mplates">
<ItemTemplate >

<strong><%# DataBinder.Eval (Container.Data Item,
"stateName").To String()%></strong>
<hr />

<asp:RadioButto nList ID="RblCities" runat="server"
RepeatDirection ="Horizontal " RepeatColumns=" 5" CssClass="text"
CellPadding="5" />

</ItemTemplate>
</asp:Repeater>

However, when the page is loaded, it shows the error:

Unable to find control id 'RblCities' referenced by the
'ControlToValid ate'
property of 'VrqCity'.

What's wrong?
ywb.


Feb 16 '06 #3

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

Similar topics

0
1795
by: Bob Hoke | last post by:
I am trying to do some of the things we used to do in classic ASP that required some pretty ugly loops in the .ASP page. I have two different DataSets that each have a DataView that I can change based on parameters passed in. In my .ASPX page I have created a loop (using <% ..%> blocks) that contains two different DataGrids. The loop changes parameters for the Dataviews according to the loops counter and then displays the two different...
6
5661
by: Hazzard | last post by:
I store radiobuttonlist values in the db using the string value of the radio button item value. (nvarchar) I am creating an edit functionality on the asp.net form so that when I reuse my dataentry form for edit, I search the database for the row containing the data I want, and then populate all the form fields. here is what I have so far. What I don't know what to do is for cases where a dirty database has no associated value for the...
2
3654
by: Leszek | last post by:
Hello, Is it possible to create "nested radio button lists" using VS.NET. I mean to create something like that (the following code does not work): <asp:RadioButtonList id="RadioButtonList1" runat="server"> <asp:ListItem Value="A">AAA</asp:ListItem> <asp:ListItem Value="B">BBB</asp:ListItem> <asp:ListItem Value="C">CCC</asp:ListItem> <asp:RadioButtonList id="RadioButtonList2" runat="server">
5
5503
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 -- -- BoundColumn 1 -- -- BoundColumn 2 -- -- TemplateColumn 4 -- -- RadioButtonList --
4
3081
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a label, a radiobuttonlist, etc. I'm driving myself insane trying to figure out how to get
0
1017
by: Mardy | last post by:
I'm trying to figure out the client side javascript to validate that a selection is made from a radiobuttonlist server control. I need to use client side code because I have multiple panels and buttons and I don't want the required field validator to fire for every button. I understand the server side code (attributes.add...) but am not a javascript person so would appreciate any help.
2
2404
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and answer dialog. The user answers a question, and the next subquestion appears (using dynamic html display:none|block) depending on his answer.
0
1027
by: mchauhan | last post by:
Hi Please help how do i validate that one of radiobuttonlist contained in datalist has been selected or not <asp:datalist id="datalst" Runat="server" RepeatLayout="Table" CellPadding="5" CellSpacing="5" BorderWidth="0" RepeatColumns="4"> <ItemTemplate>
1
2914
by: swarupbit | last post by:
hi, i am having an application where i am having radiobuttonlist,which is binded to database and the list is getting populated from database.i have a submit button to take the selection. now i want to check whether atleast one of the radio button is selected. and i am not getting any javascript to validate it.i am not so good at javascript and dont have much time to explore. if anyone having any idea,please share with me,its urgent. ...
0
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
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
8509
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
8610
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...
0
7345
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
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
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
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.