PDA

View Full Version : [CLOSED] Selectbox setvalue on Page_Load problem 2.1



antenonline
Apr 03, 2013, 8:43 AM
Hi from istanbul..

I have new problems with using 2.1 .. I have a select box that under code. and a store. I'm setting store datasource on Page_Load. and I try to set selectbox value with. "cmbRoomId.Setvalue(3);" function. but it is not working . if I use this code on a button click event it is working. but on Page_load not working..





<ext:SelectBox runat="server" ID="cmbRoomID" Width ="150px" StoreID="storeRooms" DisplayField="RoomName" ValueField="RoomID" > </ext:SelectBox>


<ext:Store ID="storeRooms" runat="server">
<Model>
<ext:Model runat= "server">
<Fields>
<ext:ModelField Name= "RoomID"></ext:ModelField>
<ext:ModelField Name= "RoomName"></ext:ModelField>
</Fields>

</ext:Model>
</Model>

</ext:Store>





cmbRoomID.SetValue(drGet["RoomID"]);








also try to set panel title not working on Page_Load event.


pnlTitle.Title = "YENI TOPLANTI KAYDI";

Thanks....

Daniil
Apr 03, 2013, 9:19 AM
Hi @antenonline,

To set up an initial value, please populate a SelectBox's SelectedItems collection.

antenonline
Apr 03, 2013, 11:24 AM
thanks solved the problem with your help.


cmbRoomID.SelectedItems.Add(new Ext.Net.ListItem(lblRoomName.Text, iRoomID));


but need 2 parameter. if only need one parameter(ID). it would be better...

Daniil
Apr 03, 2013, 1:54 PM
The following should work.

new Ext.Net.ListItem((object)"value");
or

new Ext.Net.ListItem() { Value = "value" };