DataGrid 's Checkbox checked on Button click
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
Yes use this script: function check_uncheck(Val) { var ValChecked = Val.checked; var ValId = Val.id; var frm = document.forms[0]; // Loop through all elements for (i = 0; i < frm.length; i++) { // Look for Header Template's Checkbox //As we have not other control other than checkbox we just check following statement if (this != null) { if (ValId.indexOf('CheckAll') != - 1) { // Check if main checkbox is checked, // then select or deselect datagrid checkboxes if (ValChecked) frm.elements[i].checked = true; else frm.elements[i].checked = false; } else if (ValId.indexOf('deleteRec') != - 1) { // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox if (frm.elements[i].checked == false) frm.elements[1].checked = false; } } // if } // for } // functionNow the Delete confirmation method: On button Click call this Hope this helps u??
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
vhs17 wrote:
Is there any javascript for this ? or any coding(C#)??
Yes. There are lot of Examples are hereitself.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
HI TRY THIS SCRIPT IF YOU WANT TO CHECK ALL CHECKBOXES ON CLICK OF BUTTON
for (var i = 0; i < e.form.elements.length; i++) { if (e.form.elements[i].name == "CHKNAME") //SET PROPERTY NAME="CHKNAME" FOR ALL CHECKBOXES, USE HTMLCONTROL { e.form.elements[i].checked = true; } }
bEST rEGARD pATHAN---------------------------------------------------
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
pass the datagrid name via the codebehind: btnCheckAll.Attributes.Add("OnClick","javascript:return CheckAll("dgdGrid");"); function CheckAll(dataGridName) { var ChkState = true; //count the no. of rows in the DataGrid List var count = document.getElementById(dataGridName).rows.length; for(i = 2;i<=count+1; i++) { var id = dataGridName+"__ctl" + i + "_chkSelect"; var elem = document.getElementById(id); elem.checked = ChkState ; } } where "chkSelect" will be the name of the checkbox as mentioned in the item tempelate column in the html code for the datagrid. Hope this helps !!
-
Hi All, I m using one datagrid . Each record of datagrid contains checkbox. There is one button outside the Datagrid. If i click that button then all the checkbox should be checked and also confirmation msg should be display . Is there any javascript for this ? or any coding(C#)?? plz help me. Thank you Keep Smiling............:)
Thank you All..........:)