【问题标题】:Can't uncheck checkbox in Grid View VB.NET无法取消选中网格视图 VB.NET 中的复选框
【发布时间】:2015-12-14 16:41:08
【问题描述】:

这是我的代码,当我运行应用程序时,列中的复选框全部显示为灰色,如果有人知道如何绕过以便您可以取消选中/选中,那就太好了。

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

【问题讨论】:

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


    【解决方案1】:

    您的数据源是“只读的”。

    您需要将其配置为具有插入、更新和删除语句(单击高级...按钮):

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

    【讨论】:

      猜你喜欢
      • 2014-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-06
      • 2011-01-31
      相关资源
      最近更新 更多