Hello,
I have a problem with the paging of the RadGrid that I have not been able to resolve . I define the grid in the page_load when the page is loaded for the first time as you can see in the next code:
| private void DefineGridStructureGruposDisp() |
| { |
| RDG_GruposDisp.PagerStyle.ShowPagerText = true; |
| RDG_GruposDisp.AllowPaging = true; |
| RDG_GruposDisp.AllowCustomPaging = false; |
| //RDG_GruposDisp.VirtualItemCount = 100; |
| RDG_GruposDisp.AutoGenerateColumns = false; |
| RDG_GruposDisp.GridLines = GridLines.None; |
| RDG_GruposDisp.ClientSettings.Selecting.AllowRowSelect = false; |
| //Set options to enable Group-by |
| //RDG_GruposDisp.GroupingEnabled = true; |
| RDG_GruposDisp.ShowGroupPanel = false; |
| RDG_GruposDisp.ClientSettings.AllowDragToGroup = false; |
| RDG_GruposDisp.ClientSettings.AllowColumnsReorder = true; |
| //RDG_GruposDisp.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand; |
| RDG_GruposDisp.MasterTableView.NoDetailRecordsText = "No hay Grupos "; |
| RDG_GruposDisp.MasterTableView.NoMasterRecordsText = "No hay Grupos "; |
| RDG_GruposDisp.MasterTableView.EditMode = GridEditMode.EditForms; |
| RDG_GruposDisp.MasterTableView.AllowSorting = true; |
| RDG_GruposDisp.AllowMultiRowSelection = true; |
| //RDG_GruposDisp.ShowFooter = true; |
| RDG_GruposDisp.Width = Unit.Percentage(100); |
| // Configurar paginación |
| RDG_GruposDisp.MasterTableView.PageSize = 40; |
| RDG_GruposDisp.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; |
| //Add columns |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "idGrupos"; |
| boundColumn.HeaderText = "idGrupos"; |
| boundColumn.UniqueName = "idGrupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Id Evento"; |
| boundColumn.Visible = false; |
| boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "Grupos"; |
| boundColumn.HeaderText = "Grupos"; |
| boundColumn.UniqueName = "Grupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Grupo"; |
| boundColumn.Visible = true; |
| } |
I use needdatasource to pass data where i call the funtion through Rebind():
| protected void RDG_GruposDisp_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| String Rebind = e.RebindReason.ToString(); |
| if (Rebind == "ExplicitRebind" || Rebind == "DetailTableBinding, PostBackEvent") |
| { |
| RDG_GruposDisp.DataSource = eventos.GetGruposD_P(DDLProvincias.SelectedValue) ; |
| } |
| } |
The problem is that i can´t reset the paging of the grid, I mean if I first do a query where I select a value in the combobox that retrieves 1000 data after that I change that value in the combobox now selecting 500 data and the paging is still retrieving me 1000 data, the same number of pages when indeed it should just have 500 a half of pages . However in the grid are the data correctly but the client can be confused by thinking that there are more data that shows the paging.
I hope that you understand what I wrote, sorry for my poor English.
Julio
| private void DefineGridStructureGruposDisp() |
| { |
| RDG_GruposDisp.PagerStyle.ShowPagerText = true; |
| RDG_GruposDisp.AllowPaging = true; |
| RDG_GruposDisp.AllowCustomPaging = false; |
| //RDG_GruposDisp.VirtualItemCount = 100; |
| RDG_GruposDisp.AutoGenerateColumns = false; |
| RDG_GruposDisp.GridLines = GridLines.None; |
| RDG_GruposDisp.ClientSettings.Selecting.AllowRowSelect = false; |
| //Set options to enable Group-by |
| //RDG_GruposDisp.GroupingEnabled = true; |
| RDG_GruposDisp.ShowGroupPanel = false; |
| RDG_GruposDisp.ClientSettings.AllowDragToGroup = false; |
| RDG_GruposDisp.ClientSettings.AllowColumnsReorder = true; |
| //RDG_GruposDisp.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand; |
| RDG_GruposDisp.MasterTableView.NoDetailRecordsText = "No hay idGrupos "; |
| RDG_GruposDisp.MasterTableView.NoMasterRecordsText = "No hay idGrupos "; |
| RDG_GruposDisp.MasterTableView.EditMode = GridEditMode.EditForms; |
| RDG_GruposDisp.MasterTableView.AllowSorting = true; |
| //RDG_GruposDisp.MasterTableView.DataKeyNames = new string[] { "idEvento" }; |
| RDG_GruposDisp.AllowMultiRowSelection = true; |
| //RDG_GruposDisp.ShowFooter = true; |
| RDG_GruposDisp.Width = Unit.Percentage(100); |
| // Configurar paginación |
| RDG_GruposDisp.MasterTableView.PageSize = 40; |
| RDG_GruposDisp.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; |
| //Add columns |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "idGrupos"; |
| boundColumn.HeaderText = "idGrupos"; |
| boundColumn.UniqueName = "idGrupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Id Evento"; |
| boundColumn.Visible = false; |
| boundColumn = new GridBoundColumn(); |
| RDG_GruposDisp.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.DataField = "Grupos"; |
| boundColumn.HeaderText = "Grupos"; |
| boundColumn.UniqueName = "Grupos"; |
| //boundColumn.DataFormatString = "{0:##,##}"; |
| //boundColumn.Resizable = false; |
| boundColumn.ReadOnly = true; |
| boundColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle; |
| boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; |
| //boundColumn.FooterText = "Grupo"; |
| boundColumn.Visible = true; |
| } |
How I can Bind SessionDataSource SelectCommand, UpdateCommand,DeleteCommand using LINQ so I can perform insert /update/delete automatic operation with grid using LINQ.
| <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"> |
| </telerik:RadTabStrip> |
| <telerik:RadMultiPage ID="RadMultiPage1" runat="server" OnPageViewCreated="RadMultiPage1_PageViewCreated"> |
| </telerik:RadMultiPage> |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| Ajax.Utility.RegisterTypeForAjax(typeof(RTS)); |
| if (!Page.IsPostBack) |
| { |
| Session.Add("wucNum", 1); |
| AddTab("wuc", true); |
| AddTab("wuc", true); |
| AddTab("wuc", true); |
| AddTab("wuc", false); |
| } |
| } |
| private void AddTab(string tabName, bool isEnabled) |
| { |
| int wucNum = (int)Session["wucNum"]; |
| RadTab tab = new RadTab(); |
| tab.Text = tabName + (int)Session["wucNum"] + " " + isEnabled; |
| tab.Enabled = isEnabled; |
| tab.Visible = isEnabled; |
| RadTabStrip1.Tabs.Add(tab); |
| RadTabStrip1.Tabs[RadTabStrip1.Tabs.Count - 1].Selected = true; |
| RadPageView pageView = new RadPageView(); |
| pageView.Enabled = isEnabled; |
| pageView.Visible = isEnabled; |
| pageView.ID = tabName + (int)Session["wucNum"] + " " + isEnabled; |
| RadMultiPage1.PageViews.Add(pageView); |
| } |
| protected void RadMultiPage1_PageViewCreated(object sender, Telerik.Web.UI.RadMultiPageEventArgs e) |
| { |
| string userControlName = e.PageView.ID.Substring(0, 3) + ".ascx"; |
| Control userControl = Page.LoadControl(userControlName); |
| userControl.ID = e.PageView.ID + "_userControl"; |
| e.PageView.Controls.Add(userControl); |
| } |
| <table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%" text-align="left"> |
| <tr> |
| <td> |
| <telerik:RadGrid ID="SearchResultsRadGrid" runat="server" |
| DataSourceID="SiteSearchResultsObjectDataSource" SkinID="RadGridHeaderSkin" |
| GridLines="Vertical" Style="margin: 0px 10px 0px 10px" OnSelectedIndexChanged="SearchResultsRadGrid_SelectedIndexChanged" |
| OnItemDataBound="SearchResultsRadGrid_ItemDataBound" |
| OnNeedDataSource="SearchResultsRadGrid_NeedDataSource" |
| AutoGenerateColumns="False" onprerender="SearchResultsRadGrid_PreRender" |
| Skin="Default"> |
| <MasterTableView DataKeyNames="ID" TableLayout = "Fixed" |
| DataSourceID="SiteSearchResultsObjectDataSource" Frame="Void"> |
| <NoRecordsTemplate> |
| No records to display ! |
| </NoRecordsTemplate> |
| <Columns> |
| <telerik:GridTemplateColumn HeaderText="Status" UniqueName="TemplateColumn"> |
| <ItemTemplate> |
| <asp:Label ID="StatusImageLabel" runat="server"></asp:Label> |
| </ItemTemplate> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="60px" /> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="Name" HeaderText="Site Name" SortExpression="Name" |
| UniqueName="Name"> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="40%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City" |
| UniqueName="City"> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="15%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="StateName" HeaderText="State" SortExpression="StateName" |
| UniqueName="StateName" ReadOnly="True"> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="15%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="CountryName" HeaderText="Country" SortExpression="CountryName" |
| UniqueName="CountryName" ReadOnly="True"> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Height="5px" Width="15%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Zipplus4" HeaderText="Zip" SortExpression="Zipplus4" |
| UniqueName="Zipplus4"> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="15%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn1"> |
| <ItemTemplate> |
| <asp:ImageButton ID="EditImageButton" runat="server" CssClass="GridActionColumn" CommandArgument='<%# Eval("ID") %>' |
| ImageUrl="~/App_Themes/PANCAN_Theme/Images/edit.gif" ToolTip="Edit" OnClick="EditImageButton_Click" |
| CausesValidation="False" /> |
| <asp:LinkButton ID="PreviewLinkButton" runat="server" CssClass="GridActionColumn" CausesValidation="False" CommandName="Select" |
| EnableViewState="False" Visible="false">Preview</asp:LinkButton> |
| <asp:HiddenField ID="StatusHiddenField" runat="server" Value='<%# Eval("Active") %>' /> |
| </ItemTemplate> |
| <HeaderStyle Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="#3496b4" Width="60px" /> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:ObjectDataSource ID="SiteSearchResultsObjectDataSource" runat="server" SelectMethod="SearchSite" |
| TypeName="ServiceLayer.SiteService"> |
| <SelectParameters> |
| <asp:ControlParameter ControlID="FindSiteHiddenField" Name="SearchString" PropertyName="Value" |
| Type="String" /> |
| <asp:ControlParameter ControlID="SiteStatusHiddenField" Name="Status" PropertyName="Value" |
| Type="String" /> |
| <asp:ControlParameter ControlID="ActionHiddenField" Name="Action" PropertyName="Value" |
| Type="String" /> |
| </SelectParameters> |
| </asp:ObjectDataSource> |
| </td> |
| </tr> |
| This is the SKIN FILE for the RAD GRID. |
| --------------------------------------- |
| <telerik:RadGrid runat="server" Skinid="RadGridHeaderSkin"> |
| <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true" AllowColumnsReorder="true" ReorderColumnsOnClient="true"> |
| <Resizing AllowRowResize="True" EnableRealTimeResize="false" ClipCellContentOnResize="false" ResizeGridOnColumnResize="true" AllowColumnResize="True"></Resizing> |
| <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" ScrollHeight="20px" /> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
http://www.templatemonster.com/joomla-templates/24415.html
If you can provide me detailed instructions for doing this, I would be most appreciative, and am more than happy to pay a reasonable fee.
Thanks!
<telerik:RadGrid ID="RadGridWrapper" runat="server" GridLines= "None" ShowHeader="false" BorderStyle="None" style="background-color: Transparent; " Width="550px" >
<ExportSettings ExportOnlyData="false" OpenInNewWindow="true">
<Pdf PageHeight="297mm" PageWidth="180mm" PageTitle="Email Statistics" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="true" >
<ItemTemplate>
<br />
<asp:Label ID="LabelMessageName" runat="server" Font-Bold="true" Font-Size= "Small" ></asp:Label><br />
<b>Email Stats</b><br />
<telerik:RadGrid ID="RadGridEmailStats" runat="server" GridLines= "None" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CssClass="Grid" >
<ExportSettings ExportOnlyData="false" OpenInNewWindow="true" />
<MasterTableView>
<Columns>
<telerik:GridBoundColumn HeaderText="Tracking Item" DataField="TrackingItem" SortExpression="TItem"
HeaderStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign= "Left" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Count" DataField="Count" SortExpression="Count"
HeaderStyle-HorizontalAlign= "Center" >
<ItemStyle HorizontalAlign= "Right" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<br />
<asp:Label ID="LabelDailyBreakdown" runat="server">Daily Breakdown</asp:Label>
<asp:Label ID="Label1" runat="server" Text=" "></asp:Label>
<br />
<telerik:RadGrid ID="RadGridBreakdown" runat="server" GridLines= "None" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" OnItemDataBound="RadGridBreakdown_ItemDataBound"
CssClass="Grid">
<ExportSettings ExportOnlyData="false" OpenInNewWindow="true" />
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="DateCreated" DataField="DATE_CREATED" UniqueName="DATE_CREATED" SortExpression="DATE_CREATED" Visible="True" />
<telerik:GridBoundColumn HeaderText="Opened" UniqueName="MailOpened" Reorderable="False" HeaderStyle-HorizontalAlign="Center" SortExpression="MOpened" >
<ItemStyle HorizontalAlign= "Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Hits" UniqueName="LinkHits" Reorderable="False" HeaderStyle-HorizontalAlign="Center"
SortExpression="LHits" >
<ItemStyle HorizontalAlign= "Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Opened" DataField="OPENED" Visible="False" />
<telerik:GridBoundColumn HeaderText="Unique Open" DataField="UNIQUE_OPENED" Visible="False" />
<telerik:GridBoundColumn HeaderText="Hits" DataField="HITS" Visible="False" />
<telerik:GridBoundColumn HeaderText="Unique Hits" DataField="UNIQUE_HITS" Visible="False" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</ItemTemplate>
</MasterTableView>
</telerik:RadGrid>