How to use QueryString Values in Kendo UI Mobile

4 posts, 0 answers
  1. Jarrett
    Jarrett avatar
    9 posts
    Member since:
    Mar 2011

    Posted 18 Aug 2012 Link to this post

    I am sure this is a dumb question but I have not been succesful in finding the answer.  How do I get the value of a querystring example below im trying to get the querystring value from querystring parameter named ID and set it in the data part of my datasource.  my data source works hard coded.

    var

     

     

    dsDetails = new kendo.data.DataSource({

    group: { field:

     

    "_Title", dir: "asc" },

    transport: {

    read: {

    url:

     

    "../api/EventDetails",

    dataType:

     

    "json",

    data: {

    ID:

     

    "4dc2fa9a-fb45-4ff5-b6d8-c246dbd3024e";

    }

    }

    }

    },

    schema: {

    model: {

    fields: {

    _ID: { type:

     

    "string" },

    _BeginDate: { type:

     

    "string" },

    _Cost: { type:

     

    "string" },

    _EndDate: { type:

     

    "string" },

    _EndTime: { type:

     

    "string" },

    _EventType: { type:

     

    "string" },

    _StartTime: { type:

     

    "string" },

    _SupportedBy: { type:

     

    "string" },

    _Title: { type:

     

    "string" }

    }

    }

    },

    });

    ds.read();

  2. Jarrett
    Jarrett avatar
    9 posts
    Member since:
    Mar 2011

    Posted 30 Aug 2012 Link to this post

    Possibly im asking this question wrong that is a querystring should not be used with a kendo ui mobile web app.  Basically I want to select an item on a listview have that post the value to a different Page/View  and use that value as a parameter in the data source on the new page/view
  3. Kendo UI is VS 2017 Ready
  4. Jarrett
    Jarrett avatar
    9 posts
    Member since:
    Mar 2011

    Posted 31 Aug 2012 Link to this post

    OK I have found that querystring values are called View Parameters and can be used like this lets say this is the link used to call the page:  http://localhost:54235/Mobile/#MyDetails.htm?ID=9a4b15a5-c5f1-46f1-a510-51602c53e65d 


    <div data-role="view" data-layout="default" id="MyDetails" data-show="MyDetailsShow" >
    </div>

    <script>
    function MyDetailsShow(e) {
    var IDstring = e.view.params.ID
    };
    </script>

    This will set the variable IDstring = to the querystring value for ID.  

    My issue is this only works the first time the page loads,  so if you use the back button, then select a different item from the main list, you have to refresh the MyDetails view/page in order for the information to show.   Im now not sure about the Kendo UI Mobile page life cycle.  
  5. Mike
    Mike avatar
    1 posts
    Member since:
    Sep 2008

    Posted 13 May 2014 Link to this post

    This helped.  Thanks for sharing.
Back to Top
Kendo UI is VS 2017 Ready