Combobox在DataItemTemplate中 [英] Combobox in a DataItemTemplate

查看:569
本文介绍了Combobox在DataItemTemplate中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AspxGridView中,DataItemTemplate中有两个组合框,手动加载。所以当用户选择第一个组合的一个字段将被禁用,我写道:

In the AspxGridView there are two comboboxes in DataItemTemplate, manually loaded. So when user selects one field of the first combo second will be disabled, i wrote this:

<dxe:ASPxComboBox ID="cmbEqualNotEqual" runat="server" 
                                                ClientInstanceName="cmbCEqualNotEqual" EnableClientSideAPI="true">
                                                <Items>
                                                    <dxe:ListEditItem Text=" " Value="0" />
                                                    <dxe:ListEditItem Text="Eşittir" Value="1" />
                                                    <dxe:ListEditItem Text="Eşit Değildir" Value="0" />
                                                </Items>
                                                <ClientSideEvents SelectedIndexChanged="function(s,e){
                                                    alert(s.GetEnabled());
                                                    var selectedIndex = s.GetSelectedIndex();
                                                    if(selectedIndex == 2)
                                                    {
                                                        cmbCBiggerSmaller.SetEnabled(false);
                                                    }
                                                }" />
                                            </dxe:ASPxComboBox> 

但是这个代码在最后一行禁用组合,而不是行用户。如何禁用行用户工作?

But this code disables the combo at the last row, not the row user works on. How can i disable the row user works on?

感谢

推荐答案

出现此问题的原因是ClientInstanceName属性为同一列中的所有编辑器设置为相同的值。一个可能的解决方案是处理ASPxGridView的HtmlRowCreated事件,并将两个编辑器的ClientInstanceName设置为唯一值。此外,在这个事件处理程序中,您应该编写客户端SelectedIndexChanged事件处理程序。最后,要获取编辑器实例,请使用ASPxGridView的FindRowCellTemplateControl方法。

The problem appears because the ClientInstanceName property is set for all editors in the same column to the same value. A possible solution is to handle the HtmlRowCreated event of the ASPxGridView and set the ClientInstanceName for both editors to a unique value. Also, in this event handler you should write the client side SelectedIndexChanged event handler. Finally, to obtain an editor instance, use the ASPxGridView's FindRowCellTemplateControl method.

此外,以下文章可能对您有所帮助:

Also, the following article can be helpful to you:

http://www.devexpress.com/Support /Center/ViewKBIssue.aspx?kbid=K18282

这篇关于Combobox在DataItemTemplate中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆