| |

VerySource

 Forgot password?
 Register
Search
View: 823|Reply: 1

How to control checkbox with JS script in DataGrid

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-24 22:40:01
| Show all posts |Read mode
How to check whether the checkbox with JS script in DataGrid is selected? Thanks for providing the code!
Reply

Use magic Report

0

Threads

41

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-2-14 16:00:01
| Show all posts
private void IsChecked ()
{
string jsScript = "<script language = JavaScript>\n"
+ "<!-\n"
+ "function IsChecked (frm) {\n"
+ "var chkNum = 0;\n"
+ "// loop through all elements\n"
+ "for (i = 0; i <frm.length; i ++) {\n\n"
+ "// Look for our checkboxes only\n"
+ "if (frm.elements [i] .name.indexOf ('chkChoose')! =-1) {\n"
+ "// selected record\n"
+ "if (frm.elements [i] .checked) {\n"
+ "chkNum = chkNum +1;\n"
+ "}\n"
+ "}\n"
+ "}\n"
+ "if (chkNum == 0) {\n"
+ "alert ('Please select asset extension attributes!');\n"
+ "return false;}\n"
+ "}\n\n\n"
+ "//->\n"
+ "</ script>";
if (! IsClientScriptBlockRegistered ("clientScript"))
{
// test if the script of this ID has been registered, if it is not registered yet
Page.RegisterClientScriptBlock ("clientScript", jsScript);
}
// --------- End of modification record ----------
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list