My problem is that the selected index changed event of Obout Combobox doesn't fire at all.
See my code below :
<obout:ComboBox ID="ddPractice" runat="server" Width="350" MenuWidth="650" Height="180"
DataTextField="LocationText" DataValueField="LocationID" EmptyText="Search By Practice Name/Code/PostCode"
EnableLoadOnDemand="true" EnableVirtualScrolling="true" AutoValidate="true" AutoPostBack="true" AllowCustomText="false"
TabIndex="11">
<HeaderTemplate>
<div class="header" style="width: 290px;">
Practice
</div>
<div class="header" style="margin-left: 0px; width: 90px;">
PostCode
</div>
<div class="header" style="margin-left: 0px; width: 90px;">
Practice Code
</div>
<div class="header" style="margin-left: 0px; width: 100px;">
PCT
</div>
</HeaderTemplate>
<ItemTemplate>
<div class="item" style="width: 290px;">
<%# Eval("LocationName")%>
</div>
<div class="item" style="margin-left: 0px; width: 90px;">
<%# Eval("PostCode")%>
</div>
<div class="item" style="margin-left: 0px; width: 90px;">
<%# Eval("PracticeCode")%>
</div>
<div class="item" style="margin-left: 0px; width: 100px;">
<%# Eval("PCTName")%>
</div>
</ItemTemplate>
</obout:ComboBox>
<asp:TextBox ID="txtPractice" runat="server" Width="250px" Height="21" Visible="false" />
Code behind
Private Sub ddPractice_SelectedIndexChanged(sender As Object, e As Obout.ComboBox.ComboBoxItemEventArgs) Handles ddPractice.SelectedIndexChanged
If ddPractice.SelectedValue = "685" Then
txtPractice.Visible = True
End If
End Sub
I also have a function that loads items to the combobox
Private Sub Practice_LoadingItems(sender As Object, e As Obout.ComboBox.ComboBoxLoadingItemsEventArgs) Handles ddPractice.LoadingItems
Dim data As DataTable = GetPractices(e.Text, e.ItemsOffset, 10)
Dim combobox As Obout.ComboBox.ComboBox = CType(sender, Obout.ComboBox.ComboBox)
combobox.DataSource = data
combobox.Items.Clear()
combobox.DataBind()
e.ItemsLoadedCount = e.ItemsOffset + data.Rows.Count
e.ItemsCount = GetPracticesCount(e.Text)
End Sub
I have seen a similar question in stack overflow but it doesnot have any answers.Also since I don't have aenough reputation I can't comment on it .
Please help.
Hi I have managed to make the Selected Index changed event work.
The only thing I did is in the aspx page I added AllowCustomText="true" instead of false.
<obout:ComboBox ID="ddPractice" runat="server" Width="350" MenuWidth="650" Height="180"
DataTextField="LocationText" DataValueField="LocationID" EmptyText="Search By Practice Name/Code/PostCode" AutoPostBack="true"
EnableLoadOnDemand="true" EnableVirtualScrolling="true" AutoValidate="true" AllowCustomText="true"
TabIndex="11" style="top: 0px; left: 0px">
That has solved my problem!
Please note: If this value is set to false it will not give you the selected value.It will be always empty. So before saving Set AllowCustomText ppty to False and then save it!.
It is weird why that could be causing an issue but it worked!
Thanks for all your help!