gridview

Validate radio button in datagrid, datalist, gridview on button

Posted on July 8, 2009. Filed under: Asp.net, Datalist, JavaScript, Repeater, gridview |

HereĀ  ‘questionlist’ is the id of Datalist or datagrid or Gridview or repeater
u call this function on button events
<button onclick=”return isconfirm()” />
<script language=javascript>
function isconfirm()
{
var counter=0;
var obj=document.getElementById(“<%=questionlist.ClientID%>”).getElementsByTagName(“input”);
for(i=0;i<=obj.length-1;i++)
{
if(obj[i].type==”radio” && obj[i].checked==true)
{
counter++;
}
}
if(counter==0)
{ alert(‘Plz Select question Answer’);
return false
}
return true;
}
</script>

Read Full Post | Make a Comment ( None so far )

    About

    Hi,I am Suresh Sharma from Gorakhpur , UP, India.I have work on .net technology from 2 years. Key skills-Asp.net 2.0,3.5, Sql 2005,2000. Ajax.net 1.1,C#.net

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS
    • Subscribe in Rojo

    Meta

Liked it here?
Why not try sites on the blogroll...