C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Validation For RadioButton


Posted Date: 04 Dec 2008      Posted By: Macson      Member Level: Gold     Points: 1   Responses: 3



i have radiobuttonlist in that i have three item for that i want create client side validation when i will click on button if radiobutton is not check i want to display alert messege "plz select item"in asp.net using c#




Responses

Author: indra sena reddy    04 Dec 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

write a javascript function for alert message
in page load event of page
check by if radiobuttionlist.items.checked =true
go on
else
alert (select radio button)



Author: Preet    04 Dec 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Use JavaScript function for that, pass three arguments ids of radiobuttons and call it on click of the button.

Try this:-

function chkRadio(rdoLst)
{
var ele,i;
ele = document.getElementById(rdoLst);
for(i=0;i<ele.Items.Count;i++)
{
if(ele.Items[i].checked==true)
break;
}
if(i>ele.Items.Count)
alert("pls select item");
}

Hope it helps



Author: srikanth ravipati    04 Dec 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 3

Hi
function checkform(form)
{
var checked = false;
var buttons = form.elements.button;
for (var i=0; i<buttons.length; i++)
{ if (buttons[i].checked) { checked = true; break; } } if(!checked) alert("you have to choose a button"); return checked ; }
.


onsubmit="return checkform(this)"



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Passing XML through ASP.net querystring URL?
Previous : problem in dynamic created menu
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use