This is a migrated thread and some comments may be shown as answers.

Paghing of RadGriid which is in usercontrol

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tanya
Top achievements
Rank 1
Tanya asked on 09 Jun 2014, 02:21 PM
I've got radgrid control which is inside a user ascx file. I'm doing this because I should use radgrid in mvc(so there is no other way - is should wrap it in user control)


<%@ Control Language="C#" AutoEventWireup="true" Inherits="MvcBeaWeb.ProductsShowTile" CodeFile="ProductsShowTile.ascx.cs" %><br><%@ Import Namespace="MvcBeaWeb" %><br><%@ Register Assembly="Telerik.Web.UI" TagPrefix="telerik" Namespace="Telerik.Web.UI" %><br><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><br><br><br><form id="form_TilesShow" runat="server"><br><br><telerik:RadScriptManager ID="RadScriptManager1" runat="server" ><br></telerik:RadScriptManager><br>  <br>     <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanelTilesShow" LoadingPanelID="RadAjaxLoadingPanelTilesShow"<br>         HorizontalAlign="Center"   Width="472px" ><br><br>         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"><br>        <AjaxSettings><br>            <telerik:AjaxSetting AjaxControlID="radGrid1"><br>                <UpdatedControls><br>                    <telerik:AjaxUpdatedControl ControlID="radGrid1" /><br>                </UpdatedControls><br>            </telerik:AjaxSetting><br>        </AjaxSettings><br>    </telerik:RadAjaxManager><br>         <div class="mainHolder"><br>                 <div class="qsf-ib tileListHolder">        <br>                      <telerik:RadGrid runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="True" PageSize="3" OnPageIndexChanged="RadGrid2PageIndexChanged"  ><br>                          <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" PageSizeControlType="RadComboBox"></PagerStyle><br>                             <MasterTableView><br>                                <Columns><br>                                      <telerik:GridBoundColumn DataField="ArticlegroupID" HeaderText="idddd" UniqueName="groupID">                           <br>                                      </telerik:GridBoundColumn><br>                                 <br>                                       <telerik:GridBoundColumn DataField="SpecialWord" HeaderText="ProductDescription" UniqueName="ProductDescr" ><br>                                       </telerik:GridBoundColumn>  <br>                                       <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="ImageFile"<br>                                            AlternateText="Customer image" <br>                                            ImageAlign="Middle" ImageHeight="100px" ImageWidth="82px" HeaderText="Image Column"><br>                                       </telerik:GridImageColumn>   <br>                                </Columns><br>                             </MasterTableView><br>                     <br>                          <br><br>                      </telerik:RadGrid>    <br>                     <br>                                              <br>                 </div><br>         </div><br>     </telerik:RadAjaxPanel> <br>    <br></form>



As I want to use paging  I have set allow pagin to true; In my ascx.cs file I only have Onneeddata source function in which I bind the datasource of the grid. The strangest thing is that it showas me - 3 items of 4/ page1 but nothing happens when I click the second page. There is not even a javascript error  


nam
espace MvcBeaWeb<br>{<br>    public partial class ProductsShowTile: System.Web.Mvc.ViewUserControl<br>    {<br>        protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)<br>    {<br>           <br><br>            RadGrid p_RadIconProducts = this.FindControl("RadGrid1") as RadGrid;<br><br>            List<WebServiceBeaMenu> radTileIcon = new List<WebServiceBeaMenu>();<br>            radTileIcon = MvcBeaDAL.WebServiceBea.GetArticle(p_menuID, p_articlegroupID, p_id).ToList();<br>            p_RadIconProducts.DataSource = radTileIcon;<br>      <br>    }<br>


I'm starting to wonder if I would be able to use paging in mvc as here in mvc there is no postback and I would be happy if you advise me how to overcome this probklem




1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 12 Jun 2014, 11:06 AM
Hi Tanya,

Generally the Telerik UI for ASP.NET AJAX is not supported in an MVC setup. However there are some hacks which can force the controls as RadGrid to work into the MVC scenario. On the following links you can find blog posts which describe how you can use the RadGrid control in ASP.NET MVC scenario:
http://blogs.telerik.com/vladimirenchev/posts/08-10-07/using-telerik-radgrid-in-asp-net-mvc-together-with-renderpartial-ajax-form-ajax-actionlink-and-updatemodel.aspx
http://weblogs.asp.net/rashid/telerik-asp-net-mvc-grid-preview-take-1

I hope this helps.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Tanya
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or