2011-05-05 33 views
0
<code> 
    <asp:Content ID="manageProfileContent" runat="server" ContentPlaceHolderID="mainContentPlaceHolder"> 
    <div class="Menu"> 
     <asp:Label ID="manageProfileTitle" runat="server" Text="Manage Profile" /> 
    </div>    
    <br /> 
    <asp:Panel ID="manageProfileMessagePanel" runat="server"> 
     <asp:Label ID="manageProfileMessageLabel" runat="server" Font-Names="Sans-serif" Font-Size="Medium" Font-Bold="true" ForeColor="Red" Text="" /> 
    </asp:Panel> 
    <br /> 
    <asp:GridView ID="profileGridView" runat="server" AutoGenerateColumns="False" 
     BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
     CellPadding="3" ForeColor="Black" GridLines="Vertical" 
    DataKeyNames="userid" DataSourceID="profileGridViewSqlDataSource"> 
     <FooterStyle BackColor="#CCCCCC" /> 
     <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> 
     <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" /> 
     <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" /> 
     <AlternatingRowStyle BackColor="#CCCCCC" /> 
     <Columns> 
      <asp:BoundField DataField="userid" HeaderText="userid" ReadOnly="True" 
       SortExpression="userid" /> 
      <asp:CheckBoxField DataField="administrator" HeaderText="administrator" 
       SortExpression="administrator" /> 
      <asp:CheckBoxField DataField="policy_originator" HeaderText="policy_originator" 
       SortExpression="policy_originator" /> 
      <asp:CheckBoxField DataField="policy_approver" HeaderText="policy_approver" 
       SortExpression="policy_approver" /> 
      <asp:CheckBoxField DataField="employee" HeaderText="employee" 
       SortExpression="employee" /> 
     </Columns>   
     </asp:GridView> 
    <asp:SqlDataSource ID="profileGridViewSqlDataSource" runat="server" 
     ConnectionString="<%$ ConnectionStrings:policymgmConnectionString %>" 

     SelectCommand="SELECT [userid], [administrator], [policy_originator], [policy_approver], [employee] FROM [tbl_profile]"> 
    </asp:SqlDataSource> 
</asp:Content> 
</code> 

回答

0

不指定profileGridView.Datasource = datatable; profileGridView.DataBind();當你已經爲gridview指定了datasourceid時。正如錯誤清楚地說,要麼刪除datasourceid的gridview或行profileGridView.Datasource = datatable; profileGridView.DataBind();從你的代碼!

相關問題