Obout Combobox selected Index changed 事件不起作用
Obout Combobox selected Index changed event not working
我的问题是 Obout Combobox 的选定索引更改事件根本没有触发。
请参阅下面的代码:
<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" />
隐藏代码
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
我还有一个将项目加载到组合框的功能
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
我在堆栈溢出中看到了类似的问题,但它没有任何 answers.Also 因为我没有足够的声誉我无法评论它。
请帮忙。
您好,我已经成功地使 Selected Index changed 事件生效。
我唯一做的就是在 aspx 页面中添加了 AllowCustomText="true" 而不是 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">
解决了我的问题!
请注意:如果此值设置为 false 则不会给您选择 value.It 将始终为空。
所以在保存之前将AllowCustomText ppty设置为False然后保存!.
很奇怪为什么这会导致问题但它起作用了!
感谢您的帮助!
我的问题是 Obout Combobox 的选定索引更改事件根本没有触发。
请参阅下面的代码:
<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" />
隐藏代码
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
我还有一个将项目加载到组合框的功能
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
我在堆栈溢出中看到了类似的问题,但它没有任何 answers.Also 因为我没有足够的声誉我无法评论它。
请帮忙。
您好,我已经成功地使 Selected Index changed 事件生效。
我唯一做的就是在 aspx 页面中添加了 AllowCustomText="true" 而不是 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">
解决了我的问题!
请注意:如果此值设置为 false 则不会给您选择 value.It 将始终为空。 所以在保存之前将AllowCustomText ppty设置为False然后保存!.
很奇怪为什么这会导致问题但它起作用了!
感谢您的帮助!