Thursday, February 4, 2010

HOW TO USE SELECT ALL CHECK BOX FUNCTION



< type="text/javascript" language="javascript">
function CheckData()
{
GetSelected()
if(document.getElementById('<%=selected_qn_ids1.ClientID %>').value == "")
{
alert("No user is selected for enrollment.");
return false;
}
}
function GetSelected()
{
var grdInput;
var strSelectedIds;
var chkLength;
var intLoopCount;
var intarr = 0;
var arr = new Array(100);

grdInput = document.getElementById('<%= dgStudentEnroll.ClientID %>').getElementsByTagName("input");
chkLength = grdInput.length;

for(intLoopCount=0;intLoopCount<)
{
if(grdInput[intLoopCount].type == "checkbox")
{
if(grdInput[intLoopCount].checked == true)
{
if(document.getElementById("<%= selected_qn_ids1.ClientID %>").value == "")
{
var Qid= grdInput[intLoopCount].value;
document.getElementById("<%= selected_qn_ids1.ClientID %>").value = Qid;


}
else
{
var Qid= grdInput[intLoopCount].value;
document.getElementById("<%= selected_qn_ids1.ClientID %>").value =

document.getElementById("<%= selected_qn_ids1.ClientID %>").value + "," + Qid;
var str=document.getElementById("<%= selected_qn_ids1.ClientID %>").value;
}
intarr = intarr + 1;
}
else
{

}
}
}
}

No comments:

Post a Comment