2
あるとき、私は上に充填し、このGridView
を有するPage_Load
:無効ButtonField BoundFieldがゼロ
protected void Page_Load(object sender, EventArgs e) {
if (!Page.IsPostBack) {
GridView1.DataSource = actBO.BuscarActividades();
GridView1.DataBind();
}
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" Visible="False" />
<asp:BoundField DataField="Class" HeaderText="Class" />
<asp:BoundField DataField="Day" HeaderText="Day" />
<asp:BoundField DataField="Time" HeaderText="Time" />
<asp:BoundField DataField="Vacants" HeaderText="Vacants" />
<asp:ButtonField ButtonType="Button" HeaderText="Book" Text="Book"/>
</Columns>
</asp:GridView>
カラム「Vacantsは」int
(これは空の予約スペースの量を表す示しますクラス)。
すべての行には、特定のクラスを予約するボタンがあります。フィールド「Vacants」がゼロのときに条件を設定する必要があるので、「Book」ボタンは無効になります。
これまでのところ、これは次のようになります。image。
ご覧のとおり、空きがなくなったらボタンを無効にする必要があります。クリックすることはできません。