Friday last week in this post I suggested a big block of serialization to feed data back from a server call:

var dataJson = new StringBuilder();
using (var writer = new StringWriter(dataJson))
{
    _serializer.Serialize(new JsObject(GetData()), writer);
}

this.X().AddScript("App." + senderId + ".store.setData(" + dataJson + ");");
I just noticed in another thread opened today a much better usage that simply works without the hassle of manually serializing the object data, using Ext.NET facilities to do so (and clean up the code substantially).

So, instead of the code above, this would suffice:

this.X().Call("App." + senderId + ".store.setData", GetData());
Actually instead of .store. use .getStore().; this is the correct (and robust/supported throughout versions) way to get a component's store from client side.

So, again:

this.X().Call("App." + senderId + ".getStore().setData", GetData());
Quote Originally Posted by bbros
I think the issue #1845 is caused by the store.id which is not "reported" on the page.
That's not right. While this makes perfect sense (we cannot get stores out in the wild without their ID or another reference), the issue in question consists of not being able to pass a Store as a type reference to GetCmp(). So even if you have a store with ID, your project will simply fail building if you try to instantiate a store off a GetCmp() call simply because it does not belong to the right base class/interface to be cast.

In another point of view (and this is issue #1845 put aside), if you expected to have access to the store if you GetCmp() its owning component (grid, combo, etc) you should have been able to do so without the id (as client-side it is attained simply by App.ComboBox1.getStore()). That query working or not server-side depends on the store data being passed back to server or not.

Quote Originally Posted by bbros
Doing as you say my store.id instead of being primaryBoxStore is ext-data-store-2.
We usually suggest setting an explicit ID when referencing from code behind because letting the automatically generated IDs govern your script has great potential of making your server-side code point something else if you change client side. Some situations:
- re creating the component (it will come with the next index of the ID)
- re positioning components (thru adition components before, just moving around... first come, first served)

So while it may work for you by just "sniffing" the generated random IDs, it is very very likely to give you trouble in the future.

Thanks for sharing the full final version of the code that worked for you, this is an awesome confirmation of what really worked for you and will come handy for people facing the same issue in the future!

I will be closing the thread, but we won't lock it, so you can post follow-up if you have anything to add.