无法在网格视图VB.NET中取消选中复选框

时间:2015-12-14 16:41:09

标签: sql sql-server vb.net visual-studio

这是我的代码,当我运行应用程序时,列中的复选框都显示为灰色,如果有人知道如何绕过,以便您可以取消选中/检查这将是很好的。

<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>

1 个答案:

答案 0 :(得分:1)

您的数据源是“只读”。

您需要将其配置为具有insert,update和delete语句(单击Advanced ...按钮):

enter image description here

然后,您可以重新连接GridView并将其配置为允许编辑。