<asp:GridView ID="grdShowNews" CssClass="grid" runat="server" AutoGenerateColumns="False" RowStyle-Height="30px" HeaderStyle-Height="40px" RowStyle-CssClass="GridRowsStyle" AlternatingRowStyle-CssClass="GridAlternativeRow" HeaderStyle-CssClass="GridHeader" DataKeyNames="ID" Width="100%" OnRowDataBound="grdShowNews_RowDataBound" AllowPaging="True" OnPageIndexChanging="grdShowNews_PageIndexChanging" HorizontalAlign="Center" PageSize="5"> <AlternatingRowStyle CssClass="GridAlternativeRow" /> <Columns> <asp:TemplateField ControlStyle-Width="100" HeaderText="عنوان" ItemStyle-Width="100px"> <ItemTemplate> <%# TextTools.GetSubStringText(Eval("Title").ToString(),40) %> </ItemTemplate> <ControlStyle Width="100px" /> <ItemStyle Width="100px" /> </asp:TemplateField> <asp:TemplateField ControlStyle-Width="200" HeaderText="متن" ItemStyle-Width="200px"> <ItemTemplate> <%# TextTools.GetSubStringText(Eval("Text").ToString(),100) %> </ItemTemplate> <ControlStyle Width="200px" /> <ItemStyle Width="200px" /> </asp:TemplateField> <asp:TemplateField HeaderText="تاریخ"> <ItemStyle Width="60px" /> <ItemTemplate> <%#ConvertDate.GetPersianDate((DateTime)Eval("Date")) %> </ItemTemplate> </asp:TemplateField> </Columns> <EditRowStyle Height="80px" /> <HeaderStyle CssClass="GridHeader" Height="40px" /> <PagerSettings Mode="NumericFirstLast" /> <PagerStyle CssClass="pagerStyle" /> <RowStyle CssClass="GridRowsStyle" Height="60px" /> </asp:GridView>
Private void BindNews(); { //Binding code } protected void grdShowNews_PageIndexChanging(object sender, GridViewPageEventArgs e) { grdShowNews.PageIndex = e.NewPageIndex; BindNews(); }
grdShowNews.PageIndex = e.NewPageIndex; //Method to Load your GridView Bind_Grid();
news.ListArchive();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)