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

how to add a rad grid in sharepoint2010 webpart

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
swathi vajja
Top achievements
Rank 1
swathi vajja asked on 03 May 2010, 01:55 PM
Hi support team ,
I am bit new to this telerik.
I installed RadControls for ASP.NET AJAX Q1 2010 SP1 ,And i want to place a rad grid in sharepoint webpart.
this my .ascx
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" RestoreOriginalRenderDelegate="false"
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="grid"
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="grid" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
           </telerik:RadAjaxManager> 
<telerik:RadGrid ID="grid" runat="server" BackColor="#0066FF" ForeColor="Black" al> 
</telerik:RadGrid> 


in code behind
 
dtCommonList = List.GetItems(QueryForSDM).GetDataTable(); 
                if (dtCommonList.Rows.Count > 0) 
                { 
                    grid.DataSource = dtCommonList; 
                    grid.DataBind(); 
 
                    grid.Visible = true
                } 
                else 
                { 
                    Response.Write("no data"); 
                } 

When i deployed thi sdeploy was successful, but when adding to page
Not enough permissions. Inherit your page class from RadAjaxPage if you are running under Medium trust level.
so i changed my package.template.xml file and add my custom CAS

<CodeAccessSecurity> 
    <PolicyItem> 
      <PermissionSet class="NamedPermissionSet" version="1" Description="Permission set for SouthwesternEnergy.Partners.Web."
        <IPermission class="AspNetHostingPermission" version="1" Level="Minimal" /> 
        <IPermission class="SecurityPermission" version="1" Flags="Execution,ControlPrincipal,ControlAppDomain,ControlDomainPolicy,ControlEvidence,ControlThread" /> 
        <IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 
        version="1" ObjectModel="True" /> 
        <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="UserName" /> 
        <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="$AppDir$;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\VisualWebPartProject1" Write="$AppDir$" Append="$AppDir$" PathDiscovery="$AppDir$" /> 
      </PermissionSet> 
      <Assemblies> 
        <Assembly Name="VisualWebPartProject1" /> 
      </Assemblies> 
    </PolicyItem> 
  </CodeAccessSecurity 
  

but after that i am unable to deply solution so i added a custom target file as mentioned in this site

http://support.microsoft.com/kb/2022463

but it gave me another exception this time 

Server Error in '/' Application.

Security Exception

Description:The application attempted to perform an operation not allowed by thesecurity policy.  To grant this application the required permission pleasecontact your system administrator or change the application's trust level in theconfiguration file.

Exception Details:System.Security.SecurityException: Request for the permission of type'Microsoft.SharePoint.Security.SharePointPermission,Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Is it possible to add radgrid into sharepoint webpart?

I added necessary dlls into bin.

and even changed assemblyinfo.cs 
[assembly: AllowPartiallyTrustedCallers()] 


I just have one day left to complete this task. So kindly help to fix this issue.

2 Answers, 1 is accepted

Sort by
0
swathi vajja
Top achievements
Rank 1
answered on 04 May 2010, 06:37 AM
I fixed this issue by changing this in web.config
 <trust level="Full" originUrl="" /> 
0
David
Top achievements
Rank 1
answered on 04 May 2010, 02:11 PM
Hello,
perhaps you can also add a web.config entry for your / the telerik dll.
Do not change the web.conffig Entries manually :

Read this:

http://msdn.microsoft.com/en-gb/library/ms439965.aspx

http://msdn.microsoft.com/en-us/library/bb861909.aspx


Tags
Grid
Asked by
swathi vajja
Top achievements
Rank 1
Answers by
swathi vajja
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or