-1

私は現在DevExpressASPxGridViewを使用しており、選択チェックボックスで選択時に赤十字の画像を表示するか、選択解除すると空の画像を表示したいと考えています。そのようなことをするためのjavascriptライブラリはありますか?もしそうなら、私に例を教えていただけますか。

ソリューションがSelectionChangedイベントでのコールバックの実行を妨げないことを確認してください。

注:一般的なGridViewまたはASPxGridViewのソリューションを教えてください。

4

1 に答える 1

0

みんな、これが最善の方法だと思います。

[選択]コマンドボタンの画像を切り替えることができます。

<dx:ASPxGridView ID="ChildGridView" runat="server" KeyFieldName="Log_ID" OnCommandButtonInitialize="ChildGrid_CommandButtonInitialize" OnCustomCallback="ChildGridView_CustomCallback" Width="100%" OnHtmlRowPrepared="ChildGridView_HtmlRowPrepared">

                            <Settings showcolumnheaders="false" gridlines="None"  ShowStatusBar="Hidden" ShowPreview="true" ShowTitlePanel="false"  />
                            <SettingsPager ShowEmptyDataRows="false" Visible="false"></SettingsPager>
                            <Paddings Padding="0px" />
                            <Border BorderWidth="0px" BorderColor="#cccccc"  BorderStyle="None" />
                            <settingsbehavior  />
                            <clientsideevents selectionchanged="function(s,e){                                                                                                                                                                                                
                                                                s.PerformCallback(e.visibleIndex);
                            }" />

                            <Columns>                          
                            <dx:GridViewCommandColumn ButtonType="Image" ShowSelectCheckbox="false" Name="IsChecked">                              
                             <SelectButton  Visible="true" >                               
                               </SelectButton>
                            </dx:GridViewCommandColumn>

                            <dx:GridViewDataTextColumn FieldName="Log_ID" Caption="Log_ID" Visible="false" />
                            <dx:GridViewDataTextColumn FieldName="Message" Caption="Messages" />
                            <dx:GridViewDataTextColumn FieldName="IsRuleBad" Caption="IsRuleBad" Visible="false" />
                            <dx:GridViewDataTextColumn FieldName="Pending_MainTrade_ID" Caption="MainTradeId" Visible="false" />
                            </Columns>
                        </dx:ASPxGridView>

コードビハインド:

 protected void ChildGrid_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCommandButtonEventArgs e)
    {
        string appPath = HttpContext.Current.Request.ApplicationPath;

        ASPxGridView childGrid = sender as ASPxGridView;

        if (e.ButtonType != DevExpress.Web.ASPxGridView.ColumnCommandButtonType.Select) return;
        bool isRowSelected = childGrid.Selection.IsRowSelected(e.VisibleIndex);
        if (isRowSelected)
        {
            e.Image.Url = appPath + "/images/votedown.png";

        }
        else
        {
            e.Image.Url = appPath + "/images/voteup.png";
        }

    }
于 2011-03-18T20:10:58.787 に答える