Disable RadGrid Databinding

3 posts, 0 answers
  1. Gioce90
    Gioce90 avatar
    16 posts
    Member since:
    Nov 2015

    Posted 15 Jun 2016 Link to this post

    Hi, I have a problem with my grid. This grid is showed to the user, in a popup, when he click on a link.


    This is my grid:

    <div id="dialog" >
        <telerik:RadGrid ID="RadGrid1" RenderMode="Lightweight"
            AllowPaging="false" AllowSorting="false" AllowFilteringByColumn="false"
            PageSize="5" runat="server" >
            <MasterTableView DataKeyNames="Name" ClientDataKeyNames="Name" >
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name">


    and this is my RadClientDataSource:


    <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" >
        <ClientEvents OnCustomParameter="ParameterMap" OnDataParse="Parse" />
            <WebServiceDataSourceSettings BaseUrl="../ReportService.svc/">
                <Select Url="GetFlusso" DataType="JSON" RequestType="Post" ContentType="application/json; charset=utf-8"
                    EnableCaching="false" />
        <Schema ResponseType="JSON" >
                <telerik:ClientDataSourceModelField FieldName="Name" DataType="String" />


    This is my link (created with javascript):

    "<a href='javascript: openScartiDialog(" + id + ");'><em>CLICK</em></a>"

    where id is a parameter for a select method on web service.


    Now, these are the functions that parse to/from my web service:

    function ParameterMap(sender, args) {
        if (args.get_type() == "read" && args.get_data()) {
            var dialog = $("#dialog");
            var id = dialog.id;
            if (id != undefined) {
                var request = {
                    InputContract: {
                        IdFlusso: id
        } else {}
    function Parse(sender, args) {
        var response = args.get_response().Output;
        if (response) {
            if (response.length > 0) {
            } else {
                var model = [];


    All works. My Web Service works (I have tried with other grids).

    The problem is: the request on the server (performed by the RadClientDataSource, called by the RadGrid) is made on page load.

    I want to avoid this, I just want that the grid is loaded, showed on the link click (indeed, I want to pass the id parameter). But I don't know how.


    To be more clear, this is the rest of my implementation: the js code for showing/hiding the popup and for set the id.


    $(function () {
        $("#dialog").dialog({ autoOpen: false, modal: true, show: "blind", hide: "blind", width: "auto",
            buttons: {
                "OK": function () {
                "Annulla": function () {
    function openScartiDialog(id) {
        var div = $("#dialog");
        div.attr('id', id);
        var grid = $telerik.findGrid("RadGrid1");
        var m = grid.get_masterTableView();
        return false;



  2. Gioce90
    Gioce90 avatar
    16 posts
    Member since:
    Nov 2015

    Posted 16 Jun 2016 Link to this post

    Reading your forum I found this tip:
    set the grid attribute Visible = "false" . It seemed to work, in fact, the request to the Web service was not made at page load..

    But then I noticed that the grid is not created, in fact the methods $find or $telerik.findGrid not work. Can you tell me please how to work around this problem?

  3. Viktor Tachev
    Viktor Tachev avatar
    2501 posts

    Posted 20 Jun 2016 Link to this post


    If you set the Visible property on the server you would need to perform postback to change it.

    Another approach you can try is to handle the OnCommand event of the RadClientDataSource and cancel it initially. Also, you can add a global variable that will be set after clicking on the button. You can use that variable as flag that will indicate when the data should be requested.

    Viktor Tachev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top