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

Using RadGrid on aspx page in sharepoint 2010

1 Answer 38 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Swapnil
Top achievements
Rank 1
Swapnil asked on 28 Aug 2013, 05:24 AM
    
Hi,
    I am using the user control on aspx page in sharepoint project .On  user control i have taken radgrid.Paging,filtering of Radgrid is working fine but 'Drag a column header and drop it here to group by that column' is giving the 'Server error '/' in application . I have also tried to resolve this using NeedDatasorce event .Please resolve this. 
    Thanks in advance..


   testControl.ascx

 
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="testControl.ascx.cs" Inherits="CSOM_RetrieveItemsInAList.ControlTemplates.testControl" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2013.2.717.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
 
 
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
    AllowSorting="True"
CellSpacing="0" GridLines="None" AllowFilteringByColumn="True"
    ShowGroupPanel="True" Skin="Outlook" PageSize="50"
    AutoGenerateColumns="False" onneeddatasource="RadGrid1_NeedDataSource">
<GroupingSettings RetainGroupFootersVisibility="True"
ShowUnGroupButton="false" />
<GroupingSettings RetainGroupFootersVisibility="True"></GroupingSettings>
 
<ClientSettings Selecting-AllowRowSelect="true" AllowDragToGroup="True" EnablePostBackOnRowClick="true" >
<Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True"></Selecting>
 
 
</ClientSettings>
 
 
 
 
<MasterTableView CommandItemDisplay="Top" >
<CommandItemSettings ShowExportToExcelButton="True" ShowExportToWordButton="True"
        ShowExportToPdfButton="True" ShowExportToCsvButton="True"
        showaddnewrecordbutton="False"></CommandItemSettings>
 
    <Columns>
    <telerik:GridTemplateColumn >
            <ItemTemplate>
         
              <asp:LinkButton ID="linkbtnViewDetail" runat="server" OnClick="linkbtnViewDetail_Click"  CausesValidation="false" AutoPostBack="True">View Details</asp:LinkButton>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn FilterControlAltText="EmpName"
            UniqueName="EmpName" DataField="EmpName" HeaderText="EmpName">
            <ItemTemplate>
         
            <asp:Label ID="lblempName" runat="server" Text='<%#Eval("EmpName") %>'></asp:Label>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="Flag"
            FilterControlAltText="Filter Flag column" HeaderText="Flag"
            UniqueName="Flag" Visible="False">
            <ItemTemplate>
           
            <asp:Label ID="lblflag" runat="server" Text='<%#Eval("Flag") %>'></asp:Label>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="Employee_x0020_ID"
            FilterControlAltText="Employee_x0020_ID" HeaderText="Employee ID"
            UniqueName="EmployeeID">
            <ItemTemplate>
          
            <asp:Label ID="lblEmpID" runat="server" Text='<%#Eval("Employee_x0020_ID") %>'></asp:Label>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        <telerik:GridTemplateColumn DataField="ID"
            FilterControlAltText="ID" HeaderText="ID" UniqueName="ID" Visible="False">
            <ItemTemplate>
           
            <asp:Label ID="lblitemID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        <telerik:GridTemplateColumn DataField="LeaveRequestID"
            FilterControlAltText="LeaveRequestID" HeaderText="LeaveRequestID"
            UniqueName="LeaveRequestID" Visible="False">
            <ItemTemplate>
            
            <asp:Label ID="LblLeaveReqId" runat="server" Text='<%#Eval("LeaveRequestID") %>'></asp:Label>
 
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        <telerik:GridTemplateColumn DataField="WeekNumber"
            FilterControlAltText="Filter WeekNumber column" HeaderText="WeekNumber"
            UniqueName="WeekNumber" Visible="False">
            <ItemTemplate>
            <asp:Label ID="lblWeekNo" runat="server" Text='<%#Eval("WeekNumber") %>'></asp:Label>
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        <telerik:GridTemplateColumn DataField="Status"
            FilterControlAltText="Filter Status column" HeaderText="Status"
            UniqueName="Status">
            <ItemTemplate>
            <asp:Label ID="ll12" runat="server" Text='<%#Eval("Status") %>'  ></asp:Label>
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        <telerik:GridTemplateColumn DataField="Title"
            FilterControlAltText="Filter Subject column" HeaderText="Subject"
            UniqueName="Subject">
            <ItemTemplate>
            <asp:Label ID="ll8" runat="server" Text='<%#Eval("Title") %>'></asp:Label>
        </ItemTemplate>
        </telerik:GridTemplateColumn>
 
    </Columns>
 
</MasterTableView>
<PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
</telerik:RadGrid>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using Microsoft.SharePoint;
 
namespace CSOM_RetrieveItemsInAList.ControlTemplates
{
    public partial class testControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
          bindGrid();
        }
                                                                       
 
      public void bindGrid()
        {
            SPSite site = new SPSite("http://pasha-pc:42916");
            SPWeb web;
            DataTable dttask = new DataTable();
            DataTable dtNewtask = new DataTable();
             
            web = site.OpenWeb();
            SPList list = web.Lists["Tasks1"];
           
 
 
            dttask = list.Items.GetDataTable();
 
           RadGrid1.DataSource = dttask;
           }
              protected void linkbtnViewDetail_Click(object sender, EventArgs e)
                            {

                             }
           }
 
 
              }
        
 
        
           
        
    

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 30 Aug 2013, 11:09 AM
Hello Swapnil,

I reviewed the provided code and noticed that you have handled the NeedDataSource event in the RadGrid markup however no code for the NeedDataSource server event is provided. Also the code you have demonstrates shows that the RadGrid uses simple DataBinding in which the required features are not supported see the help topic below:
http://www.telerik.com/help/aspnet-ajax/grid-simple-data-binding.html

Please make sure that you have correctly set the NeedDataSource event and the grid binding and verify how it goes.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Sharepoint Integration
Asked by
Swapnil
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or