簡體   English   中英

無法取消選中Grid View VB.NET中的復選框

[英]Can't uncheck checkbox in Grid View VB.NET

這是我的代碼,當我運行該應用程序時,如果有人知道如何解決該問題,則該列中的復選框將全部變為灰色,這樣您便可以取消選中/選中那將是很棒的。

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." ForeColor="#333333" Height="310px" Width="946px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="True" SortExpression="Id" />
            <asp:BoundField DataField="Lender" HeaderText="Lender" ControlStyle-CssClass="lenderimg" SortExpression="Lender" FooterStyle-CssClass="lenderimg">
<ControlStyle CssClass="lenderimg"></ControlStyle>

<FooterStyle CssClass="lenderimg"></FooterStyle>
            </asp:BoundField>
            <asp:BoundField DataField="MinLoanAmount" HeaderText="Min Loan Amount" SortExpression="MinLoanAmount" />
            <asp:BoundField DataField="MaxLoanAmount" HeaderText="Max Loan Amount" SortExpression="MaxLoanAmount" />
            <asp:BoundField DataField="MinTerm" HeaderText="Min Term" SortExpression="MinTerm" />
            <asp:BoundField DataField="MaxTerm" HeaderText="Max Term" SortExpression="MaxTerm" />
            <asp:BoundField DataField="RepresentativeAPR" HeaderText="Representative APR" SortExpression="RepresentativeAPR" />
            <asp:BoundField DataField="SameDayTransfer" HeaderText="Same Day Transfer" SortExpression="SameDayTransfer" />
            <asp:BoundField DataField="Active" HeaderText="Active" SortExpression="Active" />
            <asp:CheckBoxField DataField="Visible" HeaderText="Visible" SortExpression="Visible" ValidateRequestMode="Inherit" />
        </Columns>
        <EditRowStyle BackColor="#7C6F57" />
        <EmptyDataTemplate>
            <asp:Image ID="Image1" runat="server" ImageUrl="#" />
        </EmptyDataTemplate>
        <FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
        <HeaderStyle BackColor="#353526" Font-Bold="false" ForeColor="White" Height="50" CssClass="header" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#353526" />
        <SortedAscendingHeaderStyle BackColor="#246B61" />
        <SortedDescendingCellStyle BackColor="#D4DFE1" />
        <SortedDescendingHeaderStyle BackColor="#15524A" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DataGridConnectionString1 %>" SelectCommand="SELECT * FROM [Table]"></asp:SqlDataSource>

您的數據源是“只讀的”。

您需要對其進行配置,使其具有插入,更新和刪除語句(單擊“高級...”按鈕):

在此處輸入圖片說明

然后,您可以重新連接GridView並將其配置為允許編輯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM