Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > LINQ to SQL issue

Not answered LINQ to SQL issue

Feed from this thread
  • Michael avatar

    Posted on Feb 23, 2012 (permalink)

    I am getting the following error when trying to bind a radgrid:

    'Telerik.Web.UI.GridDynamicQueryable.GroupBy(System.Linq.IQueryable, string, string, params object[])' is inaccessible due to its protection level

    Here is my code in my need date source:

    var test = from p in DbContext.Entered_Comments
                       where p.comment_id = 1;
            radgrdResultDetail.DataSource = test;


    I have my dbContext declared up above, when i try and declare within the method the same error occurs. Here is my radgrid client side code

    <telerik:RadGrid ID="radgrdResultDetail" runat="server" AutoGenerateColumns="False"
                       PageSize="20" GridLines="None" Skin="247" EnableEmbeddedSkins="False" AllowPaging="True"
                       CellSpacing="0" AllowSorting="True" OnPreRender="radgrdResultDetail_PreRender"
                       OnItemDataBound="radgrdResultDetail_ItemDataBound" OnNeedDataSource="radgrdResultDetail_GetData"
                       OnItemCommand="radgrdResultDetail_ItemCommand" meta:resourcekey="radgrdResultDetailResource1">
                       <ClientSettings EnablePostBackOnRowClick="false">
                           <Scrolling AllowScroll="false" UseStaticHeaders="true" />
                           <Animation AllowColumnReorderAnimation="True" AllowColumnRevertAnimation="True" />
                       </ClientSettings>
                       <MasterTableView InsertItemPageIndexAction="ShowItemOnFirstPage" EditMode="InPlace"
                           CommandItemDisplay="bottom" DataKeyNames="comment_id" AllowAutomaticInserts="false" AllowAutomaticUpdates="true"
                           runat="server">
                           <PagerStyle AlwaysVisible="true" />
                           <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                           <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                           </RowIndicatorColumn>
                           <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                           </ExpandCollapseColumn>
                           <Columns>
                           </Columns>
                           <EditFormSettings>
                               <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column">
                               </EditColumn>
                           </EditFormSettings>
                       </MasterTableView>
                       <FilterMenu EnableImageSprites="False">
                       </FilterMenu>
                       <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Hay">
                       </HeaderContextMenu>
                   </telerik:RadGrid>

    When trying this in a test solution without a telerik grid this works no issues. Are there any specific setting i need to set so this works?

    Reply

  • Posted on Feb 23, 2012 (permalink)

    Hello Michael,

    Check the following demo.
    Grid / LinqToSql Operations

    -Shinu.

    Reply

  • Michael avatar

    Posted on Feb 24, 2012 (permalink)

    Thanks for the link but it does not explain to me how my code is returning this error. That splution is using a LinqToSQL datasource which I am not using.

    Reply

  • Michael avatar

    Posted on Feb 27, 2012 (permalink)

    Could someone please assist me with this? Surely the error "'Telerik.Web.UI.GridDynamicQueryable.Where<T>(System.Linq.IQueryable<T>, string, params object[])' is inaccessible due to its protection level" has been encountered before or someone knows the root cause?

    Reply

  • Antonio Stoilkov Antonio Stoilkov admin's avatar

    Posted on Feb 29, 2012 (permalink)

    Hi Michael,

    You could try the following solutions:
    • Include a select clause in the LINQ query as it is shown in the example below
    var test = from p in DbContext.Entered_Comments
                       where p.comment_id == 1
                       select p;
    • If your application is in Medium Thrust you could try setting EnableLinqExpressions to false. Additionally, you could go though the Medium Trust Support help article

    All the best,
    Antonio Stoilkov
    the Telerik team
    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 their blog feed now.

    Reply

  • Dustin avatar

    Posted on Mar 1, 2012 (permalink)

    you got using System.Linq declared? that is how i fixed my error

    Reply

  • Antonio Stoilkov Antonio Stoilkov admin's avatar

    Posted on Mar 6, 2012 (permalink)

    Hello Dustin,

    In order for LINQ operations to work a using to System.Linq should be declared. I am glad that the issue you were facing is now resolved. Please do not hesitate to contact us if you have any additional questions.

    Greetings,
    Antonio Stoilkov
    the Telerik team
    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 their blog feed now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > LINQ to SQL issue
Related resources for "LINQ to SQL issue"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]