Oct 09, 2013, 9:33 AM
[CLOSED] [2.2] Combobox selecteditem problem
Hi,
with combobox I can't select the item by value.
The follow code explain the example:
1. To add the listitem to SelectedItems collection - not works
2. Use SelectedItem.Value - not works
3. Use setValue method - This show the vallue and not select by value (The combo show 2 intead of "Value of : 2")
Can you help me?
thanks
with combobox I can't select the item by value.
The follow code explain the example:
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack && !X.IsAjaxRequest)
{
for (int i = 0; i < 10; i++)
{
cb.Items.Add(new Ext.Net.ListItem()
{
Text = "Value of :" + i.ToString(),
Value = i.ToString()
});
}
}
}
protected void btn_Click(object sender, DirectEventArgs e)
{
Ext.Net.ListItem li = new Ext.Net.ListItem(2);
li.Mode = ParameterMode.Raw;
cb.SelectedItems.Add(li);
//cb.SelectedItem.Value = "2";
//cb.SetValue(2);
}
</script>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Gray" CleanResourceUrl="false" RethrowAjaxExceptions="true">
</ext:ResourceManager>
<ext:ComboBox ID="cb" runat="server" Editable="false" Width="400" AllowBlank="false" >
</ext:ComboBox>
<ext:Button runat="server" Text="select">
<DirectEvents>
<Click OnEvent="btn_Click"></Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>
I try to use tree method to select by value.1. To add the listitem to SelectedItems collection - not works
2. Use SelectedItem.Value - not works
3. Use setValue method - This show the vallue and not select by value (The combo show 2 intead of "Value of : 2")
Can you help me?
thanks
Last edited by Daniil; Oct 09, 2013 at 1:03 PM.
Reason: [CLOSED]