View Full Version : [CLOSED] StoreParameter on ObjectDataSource

Oct 16, 2013, 3:46 PM
Another one of those kindergarten questions:

Can I use a StoreParameter with an ObjectDataSource? For example, suppose I have a method like this:

public class Town
public string TownName {get; set;}
public string StateCode {get; set;}
public string ZipCode {get; set;}
public int Population {get; set;}

public static List<Town> ListTownsInState(string StateCode)
// [code that returns a list of towns from the database for a state]

<asp:ObjectDataSource ID="StateTownsDataSource" runat="server" SelectMethod="ListTownsInState" TypeName="Town">
<asp:Parameter Name="StateCode" Type="String" />
<ext:Store ID="StateTownsStore" runat="server" DataSourceID="StateTownsDataSource" ClidnetIDMode="static">
<ext:StoreParameter Name="StateCode" Value="MO" Mode="Value" />
<ext:Model ID="StateTownModel" runat="server" IDProperty="TownName">
<ext:ModelField Name="TownName" Type="String" />
<ext:ModelField Name="StateCode" Type="String" />
<ext:ModelField Name="ZipCode" Type="String" />
<ext:ModelField Name="Population" Type="Int" />
<ext:GridPanel ID="StateTownPanel" Title="Towns in State" Border="true" StoreID="StateTownsStore" runat="server" ClientIDMode="static">
<ext:Column ID="Column_TownName" DataIndex="TownName" runat="server" Text="Town" Type="String" />
<ext:Column ID="Column_StateCode" DataIndex="StateCode" runat="server" Text="State" Type="String" />
<ext:Column ID="Column_ZipCode" DataIndex="ZipCode" runat="server" Text="Zip Code" Type="String" />
<ext:Column ID="Column_Population" DataIndex="Population" runat="server" Text="Population" Type="Int" />
<ext:Toolbar ID="TownsToolbar" runat="server">
<ext:Button ID="LoadTownsButton" runat="server" Text="Load Towns for Missouri">
<Click Handler="#{StateTownsStore}.reload();>

Should this work? Or am I missing something? When I run my equivalent code, I am not getting the value "MO" for the parameter StateCode in ListTownsInState in the debugger.

Oct 16, 2013, 3:49 PM
Please see the following sample

Oct 16, 2013, 3:55 PM
Ok, thanks, that's what I was afraid of ;-).

Please see the following sample