zhu_99031 你好,请尝试以下代码:
后台代码:
- protected override void Render(HtmlTextWriter writer)
- {
- CheckBox test = (CheckBox)(this.FpSpread1.FindControl("0,0,ch"));
- test.Attributes.Add("onclick", "check()");
- base.Render(writer);
- }
复制代码
前台代码:
- <script type="text/javascript">
- function check() {
- var spread;
- spread = document.getElementById("FpSpread1");
- var checkbox1 = document.getElementById("FpSpread1_0,0,ch");
- if (checkbox1.checked) {
- for (var i = 0; i < spread.GetRowCount(); i++) {
- spread.SetValue(i, 0, "true", true);
- }
- }
- else {
- for (i = 0; i < spread.GetRowCount(); i++) {
- spread.SetValue(i, 0, "false", false);
- }
- FpSpread1.UpdatePostbackData();
- FpSpread1.CallBack("Update");
- }
- return false;
- }
- </script>
复制代码 |