Click here to Skip to main content
16,021,294 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to write the following statement in javascript or in jquery?
RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-12 1:47am    
Why?
--SA

There is no such element; and of course no such attribute in HTML. This construct is the artifact of ASP.NET; when translated to HTML, this control is composed of "real" HTML radio elements, please see:
http://www.w3schools.com/jsref/dom_obj_radio.asp[^].

So, you cannot operate the properties of this control in JavaScript, because it is used in HTML.

Also, you cannot ask about JavaScript or jQuery — jQuery is JavaScript, just a JavaScript library.

If you really want to manipulate such categories as repeat direction in JavaScript, you probably have only one possibility: to create the whole component in JavaScript and provide some property similar to the ASP.NET. On adequate way of doing this is the jQuery plug-in; see:
http://docs.jquery.com/Plugins/Authoring[^].

However, I have a feeling that this is not what you really want. I suspect that your problem is lack of understanding of how server and client parts of a Web application work together and/or how HTTP works. That's why it's very important that you start with explanation of your ultimate goal. If you're trying to go in wrong direction but explain your ultimate goal, the chances are, you can get a useful advice. Not if you keep silence about it.

—SA
 
Share this answer
 
JavaScript
<script type="text/javascript">
$(document).ready(function () {
 $(#RadioButtonList1").attr('RepeatDirection', 'Horizontal');
});
</script>


Please mark as solution if this helps you.

Thanks.

http://api.jquery.com/attr/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900