看到,下面的代碼部分的複選框添加到網格視圖
<asp:TemplateField HeaderText="Email Alert">
<HeaderStyle Width="100px" HorizontalAlign="Left"></HeaderStyle>
<ItemTemplate>
<asp:CheckBox ID="chkEmailAlert1" runat="server" Visible="true" Enabled="false" Checked='<%# DataBinder.Eval(Container,"DataItem.EmailAlert") %>' />
<asp:CheckBox ID="chkEmailAlert" runat="server" Visible="false" Enabled="true" Checked='<%# DataBinder.Eval(Container,"DataItem.EmailAlert") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
,看看下面的代碼,以找到在網格視圖CheckBox控件。
foreach (System.Web.UI.WebControls.GridViewRow row in EscalationGrid.Rows) {
if ((((CheckBox)row.FindControl("chkEmailAlert")).Checked == true)) {
Arr_EmailAlert(i) = "True";
} else {
Arr_EmailAlert(i) = "False";
}
if ((((CheckBox)row.FindControl("chkSMSAlert")).Checked == true)) {
Arr_SmsAlert(i) = "True";
} else {
Arr_SmsAlert(i) = "False";
}
}