本文介绍了Devexpress:在ASPxGridLookup中添加“清除所有按钮"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的 ASPxGridLookup

<dx:ASPxGridLookup ID="GridLookup" runat="server" Text='<%# Bind("AKTOR") %>'
                        ClientInstanceName="gridLookup" DataSourceID="SqlDataSource3" 
                        KeyFieldName="KOD" MultiTextSeparator=";" SelectionMode="Multiple" 
                        TextFormatString="{0}">
                        <GridViewProperties>
                            <SettingsPager PageSize="20" />
                        </GridViewProperties>
                        <Columns>
                            <dx:GridViewCommandColumn ShowSelectCheckbox="True" />
                            <dx:GridViewDataColumn FieldName="KOD" />
                            <dx:GridViewDataColumn CellStyle-Wrap="False" FieldName="ACIKLAMA" />
                        </Columns>
                    </dx:ASPxGridLookup>

看起来像这样

我想在此控件中添加全部清除按钮.我该怎么办?

I want to add Clear All button in this control. How can I do that?

注意:类似于此示例.

推荐答案

该示例基于其他产品.您可能也想使用DropDownEditor.您应该能够在其中放置网格视图,并使用客户端功能来实现所需的功能.也许列表框也足够了.DropDownEditor允许模板中包含其他控件的复杂排列.

The example is based on a different product. You might want to use the DropDownEditor too. You should be able to place a grid view in it and use the client-side functionality to achieve what you want. Maybe a list box is sufficient, too. The DropDownEditor allows for a template with a complex arrangement of other controls.

因此您可以执行以下操作:

So you could do something like this:

<dx:ASPxDropDownEdit ClientInstanceName="checkComboBox" ID="ASPxDropDownEdit1" SkinID="CheckComboBox" Width="210px" runat="server" EnableAnimation="False">
    <DropDownWindowStyle BackColor="#EDEDED" />
    <DropDownWindowTemplate>
        <dx:ASPxGridLookup ID="GridLookup" runat="server" Text='<%# Bind("AKTOR") %>'
                    ClientInstanceName="gridLookup" DataSourceID="SqlDataSource3" 
                    KeyFieldName="KOD" MultiTextSeparator=";" SelectionMode="Multiple" 
                    TextFormatString="{0}">
                    <GridViewProperties>
                        <SettingsPager PageSize="20" />
                    </GridViewProperties>
                    <Columns>
                        <dx:GridViewCommandColumn ShowSelectCheckbox="True" />
                        <dx:GridViewDataColumn FieldName="KOD" />
                        <dx:GridViewDataColumn CellStyle-Wrap="False" FieldName="ACIKLAMA" />
                    </Columns>
        </dx:ASPxGridLookup>
        <dx:ASPxButton ID="btnClear" runat="server" Text="Clear" AutoPostBack="False" />
    </DropDownWindowTemplate>
</dx:DropDownEdit>

这会在DropDownEdit中包装一个网格,因此您实际上可以对该网格做任何您想做的事情.该按钮可用于触发所需的动作.然后,您应该决定是使用客户端脚本还是在服务器端实现该目标.但这取决于你.

That wraps a grid in the DropDownEdit, so you can actually do anything you want with that grid. The button could be used to trigger the desired action. You then should decide whether to achieve that using client side script or on the server side. But that's up to you.

替代

您可能要使用页脚模板.

You might want to use the footer template.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" Settings-ShowFooter="true">
    <Templates>
        <FooterRow>
            Hallo !
        </FooterRow>
    </Templates>
</dx:ASPxGridView>

您可以在其中放置任何内容,所以请放心.

You can put in there whatever you want, so feel free.

这篇关于Devexpress:在ASPxGridLookup中添加“清除所有按钮"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:16