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