teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

訂正(トリガーにしたいボタンがある CheckBoxListTest.aspx.cs のコード)

2020/12/11 06:10

投稿

退会済みユーザー
answer CHANGED
@@ -94,27 +94,18 @@
94
94
 
95
95
  ```
96
96
  using System;
97
- using System.Web.UI.WebControls;
98
97
 
99
98
  namespace WebApplication1
100
99
  {
101
- public partial class ChechBoxListUserControl : System.Web.UI.UserControl
100
+ public partial class CheckBoxListTest : System.Web.UI.Page
102
101
  {
103
102
  protected void Page_Load(object sender, EventArgs e)
104
- {
103
+ {
105
-
106
104
  }
107
105
 
108
- protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
106
+ protected void Button1_Click(object sender, EventArgs e)
109
107
  {
110
- if (CheckBoxList1.SelectedIndex == -1)
108
+ Label1.Text = "Page.IsValid: " + Page.IsValid;
111
- {
112
- args.IsValid = false;
113
- }
114
- else
115
- {
116
- args.IsValid = true;
117
- }
118
109
  }
119
110
  }
120
111
  }