PDA

View Full Version : [FIXED] [V0.6] ComboBox and Selected Item



amitpareek
Sep 16, 2008, 12:53 PM
Hi,
I have the following code.



<ext:Window Collapsible ="false" Modal="true" DefaultButton="#{btnaddloi}" Width="367px" Height="150px" ID="addloi" Icon ="Add" ShowOnLoad ="false" AnimateTarget ="btn" AnimCollapse ="true" runat="server" Title="Add LOI">
<Content>

<ext:Panel StyleSpec="padding:10px;" ID="loinopanel" Height="50px" runat="server" BodyBorder ="false"><Content >
<table >
<tr><td>
<ext:ComboBox AllowBlank="false" Editable="false" BlankText="Select" Width="70px" Mode ="Local" ID="precombo" runat="server">
<Items >
<ext:ListItem Text ="SRA" Value ="SRA" />
<ext:ListItem Text ="ENG" Value ="ENG" />
</Items>
<SelectedItem Text ="SRA" Value ="SRA" />
</ext:ComboBox></td>
<td><ext:Label Text ="&amp;nbsp;/&amp;nbsp;" runat="server"></ext:Label></td>
<td><ext:textfield AllowBlank="false" BlankText="Enter Loi No" EmptyText ="Please enter no" ID="txtloino" runat="server" ></ext:textfield></td>
<td><ext:Label Text ="&amp;nbsp;/T/&amp;nbsp;" runat ="server"></ext:Label></td>
<td><ext:ComboBox Editable="false" AllowBlank="false" BlankText="Select" Width="90px" ID="postcombo" runat ="server" >
<Items >
<ext:ListItem Text="Pvt." Value ="Pvt." />
<ext:ListItem Text="M.C.G.M." Value ="M.C.G.M." />
<ext:ListItem Text="MHADA" Value ="MHADA" />
<ext:ListItem Text ="Govt." Value ="Govt." />
</Items>
<SelectedItem Text="Pvt." Value ="Pvt." />
</ext:ComboBox></td></tr>
</table>





</Content></ext:Panel>
<ext:Label StyleSpec="padding-left:15px;" AutoShow ="true" ID="lbladdloi" runat="server" Text=""></ext:Label>

</Content>
<Buttons >
<ext:Button runat="server" ID="btnaddloi" Text ="Add" Icon="Add">
<Listeners >
<Click Handler="#{txtloino}.validate();#{precombo}.validate();#{po stcombo}.validate();if(!#{txtloino}.isValid()||!#{ precombo}.isValid()||!#{postcombo}.isValid()){retu rn false;};" />
</Listeners>
<AjaxEvents>
<Click OnEvent="btnaddloi_Click">

<EventMask Msg ="Adding..." MinDelay ="0"/>
</Click>

</AjaxEvents>

</ext:Button>
<ext:Button runat="server" ID="cancelloi" Text ="Close" Autopostback="false" Icon="Cancel" OnClientClick ="#{addloi}.hide();" ></ext:Button>

</Buttons>
</ext:Window>


Here, when I click the button, the value of selected item is not passed to the code behind. Its Blank. But the selected item is shown in the combobox.
try
me.lbladdloi.text = me.precombo.selecteditem.value

But when I explicitely select an item. The value is passed properly.

Looks like a bug to me.

Thanks,

Timothy
Sep 16, 2008, 5:44 PM
This was fixed in SVN; the following simplified example works:



<%@ Page Language="C#" %>
<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void btnSubmit_Click(object sender, AjaxEventArgs e)
{
lblWait.Text = "You selected: " + ComboBox1.SelectedItem.Value;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Word</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:ComboBox ID="ComboBox1" runat="server">
<SelectedItem Text="One" Value="1" />
<Items>
<ext:ListItem Text="One" Value="1" />
<ext:ListItem Text="Two" Value="2" />
</Items>
</ext:ComboBox>
<ext:Button ID="btnSubmit" runat="server" Text="Submit">
<AjaxEvents>
<Click OnEvent="btnSubmit_Click" />
</AjaxEvents>
</ext:Button>
<ext:Label ID="lblWait" runat="server" Text="Waiting ..." />
</form>
</body>
</html>


Cheers,
Timothy

amitpareek
Sep 16, 2008, 6:03 PM
Thanks Buddy...

dunno how long I will have to wait for the Preview then...

Thanks,