PDA

View Full Version : [CLOSED] Not able to get selected item value of Empty Liste Item of Combobox on Code Behind (server side)



iansriley
Feb 07, 2018, 12:17 PM
Hi, We are using Ext.Net 2.5 version, facing an issue with Combobox selected item is not getting on server side of Empty Text item.



I add items to my combobox dynamically using store databinding but I obtain an empty string from the SelectedItem.Value when the item doesn't have any text.


whereas I am able get the value from Javascript.

I am unable to get value of the selecteditem if I select empty item.



//Designer
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = new object[]
{
new object[] { "11", "Group1", },
new object[] { "12", "", },

new object[] { "13", "Group3", },
new object[] { "14", "Group4", }

};
}
</script>

<ext:Store ID="store1" runat="server" AutoLoad="true">
<Model>
<ext:Model ID="Model11" runat="server">
<Fields>
<ext:ModelField Name="GroupID" />
<ext:ModelField Name="GroupName" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:ComboBox ID="cbo1" runat="server" StoreID="store1"
DisplayField="GroupName" ValueField="GroupID"
EmptyText="Select" Width="200" Editable="true"
TypeAhead="true" ForceSelection="true" TriggerAction="All"
SelectOnFocus="true">
</ext:ComboBox>

//Code Behind


Dim GroupID As Integer = -1
If Not cbo1.SelectedItem.Value = Nothing And cbo1.SelectedItem.Index <> -1 Then
GroupID = cboContactGroup.SelectedItem.Value
End If

fabricio.murta
Feb 07, 2018, 4:58 PM
Hello @iansriley!

Can you provide a runnable code sample, preferably in a single page? I can't seem to be able to understand and reproduce your test case with the bits of code you provided.

fabricio.murta
Feb 23, 2018, 5:08 PM
Hello @iansriley!

It's been a while since we posted a request here for a runnable test case so we can reproduce the issue you are facing and be able to help you out solving it. Still, no response from you.

Do you still need assistance with this thread?

We may mark this thread as closed if you don't reply in 7+ days, but it won't prevent you from posting here whenever you feel best.