Devexpress: Add Clear All Button in ASPxGridLookup

强颜欢笑 提交于 2020-01-06 13:55:53

问题


I have a ASPxGridLookup like this;

<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>

Looks like that;

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

NOTE: Like Close button in this example.


回答1:


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.

[Edit 1]

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>

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.

Alternative

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.



来源:https://stackoverflow.com/questions/6907690/devexpress-add-clear-all-button-in-aspxgridlookup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!