2.0 BETA ExtraParam added in codebehind not being added to service call

Page 1 of 2 12 LastLast
  1. #1

    2.0 BETA ExtraParam added in codebehind not being added to service call

    Hi,

    I'm developing a small webpage but when i try to add an extra parameter to a JSON proxy from code behind it doesn't seem to update the parameter in the request.

    Can someone offer me any insight?

    //Get Json Postback Values and put in string
                String JsonRequest = e.ExtraParams["Values"];
    
                //Deserialize String And Put values into instance of object
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                IList<SiteVisit> SiteVisits = new JavaScriptSerializer().Deserialize<IList<SiteVisit>>(JsonRequest);
    
                //Build New Store Parameter
                var StoreParam = new Ext.Net.StoreParameter("VisitorID", SiteVisits[0].VisitorID.ToString(), ParameterMode.Value, false);
    
    
                //Set instance of Store that you want to ammend
                var store = this.PreviousVisitsTabPanel.GetStore();
                
                //Add pre-generated Parameter To Store
                store.Parameters.Add(StoreParam);
                //Bind Changes To Store
                store.DataBind();
                //Show tab panel
                this.PreviousVisitsTabPanel.Show();
                //Reload store
                store.Reload();
    Last edited by craigymcm; May 21, 2012 at 1:45 PM. Reason: Spelling Mistakes
  2. #2
    I thought i better make this clearer:

    The Parameter i'm adding to the store

    //Build New Store Parameter
                var StoreParam = new Ext.Net.StoreParameter("VisitorID", SiteVisits[0].VisitorID.ToString(), ParameterMode.Value, false);
    JSON Similar to {"VisitorID":"665frreerr"}

    Is not being added to the web service request after the store.reload()

    If someone could tell me where I'm going wrong it would be greatly appreciated.
  3. #3
    Sorry to bump this again guys but really struggling here.

    Upon inspection of locals I'm getting a message about changes not being committed?

    Can anyone help shed any light on this...
  4. #4

    Can anyone test this code

    Really am struggeling, can anyone confirm if this is a beta only related issue?
  5. #5
    Hi,

    We're investigating this thread/request right now and should have a response for you shortly.
    Geoffrey McGill
    Founder
  6. #6
    Params cannot be updated after store creation (client side creation) but you can pass new params to reload method
    Store1.Reload(new {@params = new {VisitorID = "NewVisitorID"}});
    Last edited by Daniil; May 28, 2012 at 10:53 AM. Reason: "params" has been replaced with "@params" as it's a key word
  7. #7
    It also could look like this:
    Ext.Net.ParameterCollection ps = new Ext.Net.ParameterCollection();
    ps.Add(new Ext.Net.Parameter("test", DateTime.Now.Second.ToString(), ParameterMode.Value));
            
    Store1.Reload(new
    {
        @params = ps.ToJson()
    });
    I think we should consider to implement the following overloaded Reload method:
    Store.Reload(new Ext.Net.ParameterCollection());
  8. #8
    Quote Originally Posted by Daniil View Post
    It also could look like this:
    Ext.Net.ParameterCollection ps = new Ext.Net.ParameterCollection();
    ps.Add(new Ext.Net.Parameter("test", DateTime.Now.Second.ToString(), ParameterMode.Value));
            
    Store1.Reload(new
    {
        @params = ps.ToJson()
    });
    I think we should consider to implement the following overloaded Reload method:
    Store.Reload(new Ext.Net.ParameterCollection());

    I've adapted the code you supplied above to add new parameters to the store but unfortunately no parameters are being requested in the web service call...

    This is the JSON returned by the Direct Event:

    {script:"App.PreviousVisitsTabPanel.setTitle(\"Previous Visits (Visitor ID: 6DED659CEC752F01)\");App.PreviousVisitsTabPanel.show();App.PreviousVisitsStore.reload({\"params\":\"{\\\"VisitorID\\\":\\\"6DED659CEC752F01\\\"}\"});"}
    But the parameter is still not being called in either the query string or being passed as a posted parameter:

    "previousvisits.php?_dc=1338218812660&callback=Ext .data.JsonP.callback4"
  9. #9
    Please try:
    @params = JRawValue.From(ps.ToJson())
    instead of
    @params = ps.ToJson()
  10. #10
    Quote Originally Posted by Daniil View Post
    Please try:
    @params = JRawValue.From(ps.ToJson())
    instead of
    @params = ps.ToJson()
    Completely worked a treat....

    Designing a proof of concept to put to senior management.

    Once approved this will result in us purchasing a developer license (With Support) for a commercial project.

    Your help has been greatly appreciated.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Aug 01, 2012, 1:20 AM
  2. [CLOSED] 411 error with ASMX POST service call without parameters
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 03, 2009, 3:59 PM
  3. Replies: 6
    Last Post: Jun 04, 2009, 12:58 PM
  4. Replies: 0
    Last Post: Feb 25, 2009, 6:05 PM

Tags for this Thread

Posting Permissions