RadGrid buggy client side Api

Thread is closed for posting
13 posts, 1 answers
  1. William
    William avatar
    21 posts
    Member since:
    Nov 2008

    Posted 24 May 2009 Link to this post

    I've been having real problems using the client side api of RadGrid. It seems to me to be incomplete / buggy / difficult to use (or i'm a bit dumb - very likely the case). Would be interesting to know if i'm doing this all wrong or if I have indeed wasted all those hours due to bugs....

    A bit of background.... I've been using WCF services to supply data to some RadGrids which are contained within web parts. To use the in built data binding in Telerik 2009.01, you need to create an "Ajax WCF Service" as it doesn't work with normal "WCF services". Not a problem, except that I couldn't get this working unless I had integrated windows authentication turned on (which isn't an option as I will be running in a DMZ). This, I will put down to my lack of knowledge with WCF... so I ended up having to use a normal WCF service and manually data bind using Javascript.

    Here are my issues:
    1.  To data bind on the client side, you need to call dataBind() on the master table view. The problem with this is that if the grid hasn't been previously data bound on the server, there is no master table view generated on the client. So, calling get_masterTableView() returns null. Hence, you can't data bind on the client side since the object which does the data binding isn't there. To get around this I implemented the NeedsDataSource event on the server and assigned it an empty list - this was enough to provide a master table view on the client side, and so allow me to data bind. It just seems a bit stupid that the thing which allows you to data bind isn't actually available by default.

    2.  Next problem... after data binding on the client side, there were no rows generated and I was getting lots of exceptions. I managed to get around this by populating the grid with enough rows of dummy data in the NeedsDataSource event on the server, then clearing this as soon as it reaches the client and calling dataBind(). Why would dataBind() on the client not generate the rows for me automatically? It seems that the rows need to be there in advance which seems a bit stupid, especially for the case where you don't know how many rows you will need.

    3.  Nested rows: There is no support on the client side for nested rows. I have previously raised this so won't ramble on but just thought to mention it as another thing that is missing.

    4.  There is also a problem where if a nested row is expanded and dataBind() is called, the expanded nested row remains visible after the data bind. So you end up with your new data, plus the old expanded nested row.

    5.  No records template: If this is visible, after data binding on the client side the no records template remains visible even if the grid contains data.

    I've finally got everything working as I want, but I have lost weeks of dev time working around these issues. It might have been easier if the documentation was of any use. E.g. search for get_masterTableView returns a 1 line statement that it gets an object of type MasterTableView, but then there is no documentation on how to use this object on the client side. Again... it's possible that I just didn't find the documentation, even though i've spent a lot of time searching - if this is the case then the documentation needs to be indexed better.

    Sorry to ramble on but my frustration levels are high!
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 28 May 2009 Link to this post

    Hello William,

    First let me point a couple of links to documentation about RadGrid client-side binding:
    Client-side binding
    WebService binding

    Both links above describe the RadGrid client-side declarative/programmatic binding concepts/heuristics.
    Getting RadGrid client object and related topics elaborate on the RadGrid client-side object and API to manipulate that object.

    Demos:
    Grid / WebService Binding
    Grid / .NET 3.5 Client-side Data Binding - automatic binding to WCF and ADO.NET services
    Grid / Declarative Binding
    Grid / Programmatic Binding
    Grid / Client-side Binding and Caching
    Grid / Master/Details Client-side Data Binding

    Blog posts:
    Codeless client-side data-binding to ADO.NET DataService
    REST Service Calls with grid client binding
    Grid client-side data-binding performance with 1 mil. records
    Codeless client-side data-binding for your ASP.NET AJAX DataGrid?
    Telerik RadGrid client-side data-binding using jQuery
    How To: Telerik RadGrid client-side caching with client-side binding to web services using LINQ to SQL
    How To: Telerik RadGrid for ASP.NET AJAX client-side data-binding to WCF
    ..and others

    I think that you are missing an important point here concerning the RadGrid client-side data-binding. Generally RadGrid transfers JSON from client-server-client in order to bind/page/sort/filter. If you are using declarative data-binding and do not bind RadGrid on the server, it will manage to create its client object properly. However, if you are manually binding it on client and do not bind it on server, you need to attach a handler to its OnCommand client event. In both cases RadGrid will bind itself on the server (if you do not bind it explicitly) with dummy data to create PageSize items. Later, when you bind it on the client side, previously created items will be populated with data. If you bind the control on client with rows more than PageSize, RadGrid will create new tr elements and populate properly the cells for certain columns.

    Since RadGrid transfers JSON  data when bound on the client, if you have some kind of templates - GridTemplateColumn/ NestedViewTemplate - there is no proper way for populating the controls in these templates as they are templates. However, for the rows that are initially created on the server (these PageSize items), RadGrid will manage to populate a control in GridTemplateColumn  if the control in that ItemTemplate has ID  set as the DataField that should be bound in that column.

    Concerning the issues:
    1. As described above, if you are performing manual data-binding attaching OnCommand client event, the RadGrid client object will be created and you do not need to bind it on the server.

    2. dataBind() method of GridTableView will create the rows. I am not sure what your case is. Please check the demos for details.

    3 - 4. As explained previously, NestedViewTemplates are not supported out of the box and need to be managed manually. OnRowDataBound client event can be intercepted to manipulate the templates.

    5. I am not sure what the case here is. If you provide us with more details - code/sample project/ instructions to reproduce it we will investigate the behavior.

    Regarding WCF services:
    It is actually not directly related to our RadControls that you should have "AJAX enabled WCF service". Yes, you should as this is the way of requesting WCF within ASP.NET AJAX application and RadControls for ASP.NET as build on the top of that framework.

    Let me know if I am wrong, but our support officers have provided you with solutions for all the issues you have faced during implementing RadGrid client-side data-binding in your application:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/client-binding-with-parameters.aspx
    http://www.telerik.com/community/forums/aspnet-ajax/grid/nestedviewtemplate-on-client-side.aspx
    http://www.telerik.com/community/forums/aspnet-ajax/grid/nestedviewtemplate-client-side-refresh-bug.aspx
    http://www.telerik.com/community/forums/aspnet-ajax/grid/databind-problem-wcf-iis-ie.aspx

    Best regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. William
    William avatar
    21 posts
    Member since:
    Nov 2008

    Posted 28 May 2009 Link to this post

    Hi Nikolay

    Thanks for all the information. I am grateful for your replies, and as you rightly point out your team have answered all my questions.

    Thanks for all the links. I will point out that I have come accross most of them at some stage in my efforts. But... I have just had another look over them and still think they aren't of much help. They seem to all consist of snipets of code, which i'm sure are valid pieces of code, but under many scenarios won't work, and it is difficult to piece all the snippets together to form a working model. There seems to be very little in the way of fully working examples, or explanations of when or when not to use certain approaches.

    As it turns out your information on the OnCommand event seems to be the key to all my problems. It appears that without implementing this method (even with no code in it), all the problems I mention exist - no grid table view, no rows, NoData template not hiding. This to me seems crazy.... why would you expect that in order for a set of objects to be created you need to implement a certain unrelated event. This doesn't make sense. I have now found a line in the documentation saying this event needs to be there, but it's not particularly well documented for something that is very likely to trip a lot of people up? I have been following most of the examples you have sent and most of them don't implement this event which lead me to believe it wasn't important.

    This is my main problem with Telerik - nothing is clear. Learning how to use these controls is painful because of stupid things like this which swallow up lots of time. There is a lot of documentation, code snippets, blogs, etc, etc, but much of it is unhelpful and misleading, and doesn't go in to any detail about the many things that will catch you out. It's as if the documentation has been written by the developer who is so aware of the problems that he automatically knows how to work around them.

    As for your point on Ajax enabled WCF services... you say it's not directly related to your controls. However, you don't explain anywhere that this is a requirement and it won't work unless you choose this option. Missing chunks of information like this can swallow days of time trying to get things working.

    I think i've rambled on enough. I'm sure some points I am making are just down to my frustration and lack of experience with Telerik, but I really do think some functionality doesn't make sense and the documentation, although there is lots of it, is very poor.
  5. Answer
    Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 01 Jun 2009 Link to this post

    Hello William,

    Thank you for the additional explanation. Now I think I see what your pain is about and agree with you that the RadGrid client-side binding documentation topics has some room for improvements and can guarantee you that the most important part of the information provided in this forum thread will be added to the help for its next version.

    Additionally, I would like to inform you (and you probably have noticed) that we constantly revise the existing content of the RadGrid documentation and update it on a regular basis (based on our customers' feedback) in places where more thorough explanation/examples are needed. This is a process which will continue in the future and more ASP.NET 3.5 help chapters concerning the grid binding through WCF/ADO.NET data services, EntityDataSource/Entity Framework, LINQ, etc. will appear in the near future (most probably for the Q2 2009 release of the product, expected in the beginning of July).

    We really appreciate your feedback on this subject and hope that you will be content with the results when these additions are already a fact.

    Kind regards,
    NIkolay,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 04 Feb 2010 Link to this post

    It is almost a year later, and the documentation STILL sucks.

    Cheers!
    Mark
  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 05 Feb 2010 Link to this post

    Hello Mark,

    The client-side binding documentation has been updated for the Q2 2009 release as we promised in this forum thread - you can find the updated here:

    http://www.telerik.com/help/aspnet-ajax/client-side-binding.html

    We plan to extend the documentation even further for the Q1 2010 release.

    Additionally, the .NET 3.5 specific topics has been added as well:

    http://www.telerik.com/help/aspnet-ajax/grdclientbindingtowcfserviceadonetdataservice.html
    http://www.telerik.com/help/aspnet-ajax/grdentityframeworkoperations.html
    http://www.telerik.com/help/aspnet-ajax/grdlinqtosqlbindingcrudoperations.html
    http://www.telerik.com/help/aspnet-ajax/grdlinqtosqlmanualcrudoperations.html

    Let me know what do you find in the current state of the documentation which is not descriptive/helpful enough and needs improvement (since you made the statement 'It is almost a year later, and the documentation STILL sucks') - I will be glad to get your comments.

    Regards,
    Sebastian,
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  8. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 05 Feb 2010 Link to this post

    Thanks, Sebastian; you can count of me to complain loudly about deficiencies in documentation.  :-)

    One point I have been making over and over: I prefer documentation in PDF form so I can print it, highlight it, makes notes, and generally have it laying around.  I do not like online documentation at all.

    Cheers!
    Mark
  9. dung
    dung avatar
    1 posts
    Member since:
    Dec 2010

    Posted 09 Feb 2011 Link to this post

    i want to bind data to radgrid from client side ( non declaretive).
    but it always throw error "System.Data.DataRowView' does not contain a property with the name 'Title'. "

    Here is my aspx code:
    "
    <MasterTableView TableLayout="Fixed">
            <ItemTemplate>      
                <asp:Panel ID="ItemContainer" Style="float: left;" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>' runat="server">
                     <div class="result-col" style="width:210px;float:left;padding:10px 10px 10px 10px">
                          <div class="product-con">
                    <div class="col-left fl" style="padding-right:5px">
                        <asp:CheckBox ID='btnCheckBox' AutoPostBack="false" runat="server" /><span></span>
                        <br />                    
                        <img src='/_layouts/IMAGES/CSDefaultSite/assets/images/icons/ico-h.jpg' alt="" />
                    </div>
                    <div class="col-right fl" style="padding-bottom:10px">
                        <div class="product-title">
                            <a href="javascript:void(0)">
                                <asp:LinkButton Text='<%#Eval("Title") %>' ID="LinkButton2" runat="server" CommandName="LINK_TO_ITEM"
                                    CommandArgument='<%# Eval("ProductId") %>'></asp:LinkButton>
                            </a>
                        </div>
                        <div class="product-author">
                            <%# Eval("ProductType").ToString() == "0"?Eval("Author"):Eval("Producer") %>
                        </div>
                        <div class="product-published">
                            <b>Published:</b><%# Eval("PublishDate") %></div>
                        <div class="product-isbn">
                            <b>ISBN:</b><%# Eval("ISBN") %></div>
                        <div class="product-status">
                             In Stock
                        </div>
                        <div class="features-bar">
                        <img src="/_layouts/IMAGES/CSDefaultSite/assets/images/text/txt-atremnb.png" alt="" />
                       </div>
                        <div class="product-price">
                            $14.00
                            <span class="product-list">List:$28.00</span></div>
                        <div class="product-discount">                                            
                            5% discount
                        </div>                  
                        <div class="product-promo">
                            <img src="/_layouts/IMAGES/CSDefaultSite/assets/images/text/txt-with-star-promo.png"
                                                        class="product-promo" alt="" />
                        </div>
                    </div>
                </div>

                          <div class="product-toolbar1 cb">
                    <b>Qty:&nbsp;</b>
                    <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="1" Width="25">
                    </telerik:RadTextBox>
                    <a href="javascript:void(0)">
                        <img alt="" onmouseover="ShowSearchResultAddCartTooltip(radOrderingTooltipManagerId,this,'<%# Eval("ProductId")%>','<%# Eval("VariantId") %>','<%# Eval("ProductType") %>');"
                            src="/_layouts/IMAGES/CSDefaultSite/assets/images/buttons/btn-add.png" class="add-product"></img>
                    </a>
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="/_layouts/IMAGES/CSDefaultSite/assets/images/buttons/btn-add-note.png"
                        ToolTip="Add" Width="70" Height="18" />
                </div>           
                    </div>
                 </asp:Panel>
              </ItemTemplate>      
              <Columns>
                <telerik:GridBoundColumn Visible="false" DataField="ProductId">
                </telerik:GridBoundColumn>
              </Columns>          
        </MasterTableView>
    "

    Because radgrid requires atleat 1 column then i add one but hide it.

    Please help.
  10. William
    William avatar
    8 posts
    Member since:
    Aug 2012

    Posted 11 Jun 2011 Link to this post

    And Mark... here goes another yr.
    I don't know when was the Courseware made, but here is the reference to one of the problem concerning this thread:
    -----------
    <ClientSettings>
    <ClientEvents OnCommand="RadGrid1_Command" />
    </ClientSettings>
    As of this writing, handling the OnCommand event is required to avoid errors. It's expected that in later
    versions of the product that this limitation will be removed.
    ------------

    it's under Client Side Code - RadGrid
    Despite the warning... I thought it(limitation) would have been removed.  So, I ignored it and bang it just would not show nothing in the grid.  Under Firefox I finally found that tableView was null in the Error console.  The problem was not immediately clear until I hit this thread.
     
    On a separate instance, I once updated my northwind DB w/o a proper Where statement and I followed the Courseware.  I suspected that would "wiped" out my table but I thought the  Grid would compensate for that.  It did messed up.  Luckily it was only three rows.

    I am writing this hoping the team can be more careful on the Courseware.  The Courseware and the Documentation are pretty much all we get in using the controls...

    it will also be nice to videos tutorials like Joe's.

    will
  11. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 15 Jun 2011 Link to this post

    Hello William,

    We are trying to keep the Courseware up to date however it is updated once for a Q. On the other hand the Documentation is updated each week and has the newest information about the controls.

    Regarding the statement for the grid client-side binding: By default the grid expects to be bound server-side. That is why we need some indication that you want to bind it client-side. One indication is if you use the declarative client-side binding. In this case, all you need to do it to set the properties in the DataBinding tag.
    In case you want to bind the grid manually, the only indication for that would be the handler for the OnCommand client-side event. We can think of another approach, but this might end up with a breaking change.

    Best wishes,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  12. William
    William avatar
    8 posts
    Member since:
    Aug 2012

    Posted 17 Jun 2011 Link to this post

    Hi Iana,

    Regarding documentation.  It's been so hard to understand (in particular the aysncupload)  that I almost punch a hole thru the screen today ~_~
    In the folowing:
    http://www.telerik.com/help/aspnet-ajax/asyncupload-onclientfilesselected.html

    how would anyone know what and if any how to use these?
    on plain word I would think just put:
    filesSelected(sender, args){
        args.set_cancel();
    }

    that would cancel the upload.  NO!?  what's the problem here?  communication is not eastablished that what syntax is required to use it properly.
    on this page:
    http://www.telerik.com/help/aspnet-ajax/asyncupload-getting-started.html

    it looks like the image is for just ordinary RadUpload?!

    FOLKS don't get me wrong.  Telerik controls are almost the best out there in terms of UI and functionality and of course customer support!  But a better communication for the documentation and materials will save alot of screens.

    will
  13. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 20 Jun 2011 Link to this post

    Hi William,

    I think I properly understand what you mean. And should thank you once again for your feedback because you are right.
    I will forward the issues with the asyncupload documentation to my colleagues so they fix them shortly.
    If you find any other inconsistences or unclear information, do let us know.

    Regards,
    Iana
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  14. Rajshree
    Rajshree avatar
    27 posts
    Member since:
    Feb 2015

    Posted 03 Aug 2015 in reply to Iana Tsolova Link to this post

    hi,

    i am having the same issue and i dont have any solution yet. is this issue resolved. please look in to my post and i tried many ways yet at the same place. please follow below post and appreciate if you identify the issue on this. the latest attachement did not resolve the issue. please not i have used batchediting in my project. see the code please.

    http://www.telerik.com/forums/not-able-to-download-file-from-grid​

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017