Jul 14, 2011, 11:08 AM
How to maintain viewstate for combobox after page postbacks?
Hi,
After selecting a list item in cmbUnitsOfMeasurement combobox , If an ext button is clicked(Autopostback="true") the selected ValueField is shown instead of DisplayField .
Thanks
venu
Html Source
After selecting a list item in cmbUnitsOfMeasurement combobox , If an ext button is clicked(Autopostback="true") the selected ValueField is shown instead of DisplayField .
Thanks
venu
Html Source
<ext:Store runat="server" ID="stUOM" OnRefreshData="stUOM_RefreshData">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="UomId" />
<ext:RecordField Name="Description" />
</Fields>
</ext:JsonReader>
</Reader>
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="15" Mode="Raw" />
</AutoLoadParams>
</ext:Store>
<ext:CompositeField ID="CompositeField1" runat="server" Width="250">
<Items>
<ext:ComboBox ID="cmbUnitsOfMeasurement" Width="230" runat="server" StoreID="stUOM" TypeAhead="false"
FieldClass="Input-small" MinChars="1" HideTrigger="true"
DisplayField="Description" ValueField="UomId" ListClass="cb-list"
MaxLength="50" LazyInit="false" ListWidth="300" PageSize="25">
<Listeners>
<AfterRender Handler="this.pageTb.refresh.hide();" />
</Listeners>
</ext:ComboBox>
<ext:Label ID="Label4" runat="server" CtCls="ColorRed" Text="*"/>
</Items>
</ext:CompositeField>
code behindprotected void stUOM_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
int count = 1;
List<UnitsOfMeasurement> listItem = SearchUOM(out count);
(stUOM.Proxy[0] as PageProxy).Total = count;
cmbUnitsOfMeasurement.GetStore().DataSource = listItem;
cmbUnitsOfMeasurement.GetStore().DataBind();
}
Last edited by Daniil; Jul 14, 2011 at 11:45 PM.
Reason: Please use [CODE] tags