<asp:GridView
ID="GridViewCacheManager"
DataSourceID="OdsCacheManager"
runat="server"
Width="100%"
CssClass="datable"
border=""
CellPadding=""
OnRowDataBound="GridViewCacheManager_RowDataBound"
OnRowCommand="GridViewCacheManager_RowCommand"
AutoGenerateColumns="False"
AllowPaging="True"
PageSize=""
AllowSorting="True" EnableModelValidation="True" ForeColor="#333333" GridLines="None"> <PagerSettings Visible="False" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left" />
<RowStyle CssClass="lupbai" BackColor="#EFF3FB" HorizontalAlign="Center" />
<HeaderStyle CssClass="lup" BackColor="#b6c9e7" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle CssClass="trnei" BackColor="White" />
<Columns> <asp:TemplateField HeaderText="选择">
<HeaderStyle Width="40px" />
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField> <asp:BoundField DataField="Title" HeaderText="标题">
<HeaderStyle Width="250px" />
</asp:BoundField> <asp:BoundField DataField="Views" HeaderText="浏览">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="Shares" HeaderText="收藏">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="Status" HeaderText="状态">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="AddTime" HeaderText="发表时间" DataFormatString="{0:yyyy-MM-dd HH:mm}" HtmlEncode="false">
<HeaderStyle Width="80px" />
</asp:BoundField> <asp:BoundField DataField="EditTime" HeaderText="编辑时间" DataFormatString="{0:yyyy-MM-dd HH:mm}" HtmlEncode="false">
<HeaderStyle Width="80px" />
</asp:BoundField> <asp:TemplateField HeaderText="常规操作">
<ItemTemplate>
<asp:LinkButton ID="lbtnview" runat="server" PostBackUrl="">查看</asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="120px" />
</asp:TemplateField> </Columns>
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:GridView> <asp:ObjectDataSource
ID="OdsCacheManager"
runat="server"
SelectMethod="SelectAllToTable"
TypeName="Data.ArticleDao"
EnablePaging="false"
StartRowIndexParameterName="startRowIndex"
MaximumRowsParameterName="maxRows"
SelectCountMethod="GetCount"> <SelectParameters>
<%--<asp:ControlParameter Name="type" ControlID="hiddenFiledType" PropertyName="value" />
<asp:ControlParameter Name="userID" ControlID="hiddenFiledUserID" PropertyName="value" /> --%>
</SelectParameters> </asp:ObjectDataSource> <asp:HiddenField ID="hiddenFiledUserID" runat="server" Value="" />
<asp:HiddenField ID="hiddenFiledType" runat="server" Value="" />
protected void GridViewCacheManager_RowCommand(object sender, GridViewCommandEventArgs e)
{
int ID = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "Del")
{
// bool isSuccess = UserDao.DeleteUserByID(ID);
}
} protected void GridViewCacheManager_RowDataBound(object sender, GridViewRowEventArgs e)
{ }
public static DataTable SelectAllToTable()
{
return result;
}