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

[Solved] Filling Grid from Service not possible

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hiram
Top achievements
Rank 1
Hiram asked on 07 Nov 2009, 01:34 PM

Hello

I am a newbie an try to following this video,
to get a first introduction in the Telerik RadControls: KevinBabcock_29.flv

The table name in the database LJT_BCEX (the same for Linq Object, no pluralization like LJT_BCEXs).
Does this cause problems?

I don't get an Error message in Visual Studio, but no data is shown. Here is my webservice:

    [System.Web.Script.Services.ScriptService]  
    public class BroadcastExchangeData : System.Web.Services.WebService  
    {  
 
        [WebMethod]  
        public Dictionary<stringobject> GetBroadcastExchangeAndCount(int startIndex, int rowCount,  
            string sortExpressions, string filterExpressions)  
        {  
            var db = new LJITDataContext();  
            var sort = !string.IsNullOrEmpty(sortExpressions);  
            var filter = !string.IsNullOrEmpty(filterExpressions);  
 
            var broadcastExchanges = (from b in db.LJT_BCEX  
                                     select b).Where(filter ? filterExpressions : "BXID > 0")  
                                     .OrderBy(sort ? sortExpressions : "BXID ASC");  
 
            var count = filter ? broadcastExchanges.Count() : db.LJT_BCEX.Count();  
            broadcastExchanges = broadcastExchanges.Skip(startIndex).Take(rowCount);  
 
            var retObj = new Dictionary<stringobject> { { "BroadcastExchange", broadcastExchanges }, { "BroadcastExchangeCount", count } };  
              
            return retObj;  
 
        } 

So the service itself seems to be ok. In debug I can see that it's returning the data properly (server side).
Here's the RadGrid Markup Code :

        <telerik:RadGrid ID="rgridMain" runat="server" AutoGenerateColumns="true" HorizontalAlign="Center" 
            AllowAutomaticDeletes="true" Width="98%" HeaderStyle-HorizontalAlign="Center">  
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle> 
            <ClientSettings EnableRowHoverStyle="true">  
                <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
                <DataBinding CountPropertyName="BroadcastExchangeCount" DataPropertyName="BroadcastExchange" 
                    FilterParameterName="filterExpressions" FilterParameterType="Linq" Location="~/Services/BroadcastExchangeData.asmx" 
                    MaximumRowsParameterName="rowCount" SelectMethod="GetBroadcastExchangeAndCount" 
                    SortParameterName="sortExpressions" SortParameterType="Linq" StartRowIndexParameterName="startIndex">  
                </DataBinding> 
                <ClientEvents OnRowDblClick="OnRowDblClick" /> 
            </ClientSettings> 
            <MasterTableView EditMode="PopUp" DataKeyNames="BXID">  
                <Columns> 
                    <telerik:GridEditCommandColumn> 
                    </telerik:GridEditCommandColumn> 
                    <telerik:GridBoundColumn HeaderText="Status" DataField="BXSTAT" /> 
                    <telerik:GridBoundColumn HeaderText="Id" DataField="BXID" /> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 


If I use Firefox/Firebug, then I can see, that there occurs a "Circular reference" with LJT_BCEX (that's the original class and table name and the name for the Linq Object).

Do I have to rename my Linq Object like Customer -> Customers?

1 Answer, 1 is accepted

Sort by
0
Hiram
Top achievements
Rank 1
answered on 08 Nov 2009, 10:12 PM
The problem is solved.

After a restart of Visual Studio, the grid was filled by the service as expected.
Tags
Grid
Asked by
Hiram
Top achievements
Rank 1
Answers by
Hiram
Top achievements
Rank 1
Share this question
or