Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

.Net produces span tag for CSS for Radiobutton controls

Posted on 2012-08-21
1
Medium Priority
?
1,059 Views
Last Modified: 2012-08-23
Hi,

I am working on ASP.net2.0 website using C#

I have a .net radiobutton control as follows:


<asp:RadioButton ID="RadioButton1" class="js-required" data-validate="isFilled" runat="server" />

When it renders it produces the result

        <span class="js-required" data-validate="isFilled"><input id="RadioButton1" type="radio" name="RadioButton1" value="RadioButton1" /></span>

After rendering can .Net produces the result as follows:

<input id="RadioButton1" type="radio" name="RadioButton1" value="RadioButton1" class="js-required" data-validate="isFilled"/>

I mean I donot wanted <span class="js-required" data-validate="isFilled"> around input control

As it is giving hard time in jquery to understand radiobutton class

Please suggest

Thanks
0
Comment
Question by:tia_kamakshi
1 Comment
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 38317757
try this
RadioButton1.InputAttributes.Add("class", "js-required")

Open in new window

Go thro this link,
http://stackoverflow.com/questions/997342/why-does-asp-net-radiobutton-and-checkbox-render-inside-a-span
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month21 days, 6 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question