aspxgridview 实现单选

<dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
            KeyFieldName="Customer_ID" ClientInstanceName="grid">
            <ClientSideEvents SelectionChanged="function(s, e) {OnGridSelectionChanged();}" />
            <Columns>
            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0"></dxwgv:GridViewCommandColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Customer_ID" ReadOnly="True" 
                    VisibleIndex="1">
                    <EditFormSettings Visible="False" />
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="CustomerAbbreviation" VisibleIndex="2">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="ChinaName" VisibleIndex="3">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="EnglishName" VisibleIndex="4">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Leader" VisibleIndex="5">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Address" VisibleIndex="6">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Tel" VisibleIndex="7">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Email" VisibleIndex="8">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Fax" VisibleIndex="9">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Area" VisibleIndex="10">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Nature" VisibleIndex="11">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="MainBrand" VisibleIndex="12">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="MainProduct" VisibleIndex="13">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="ScaleLevel" VisibleIndex="14">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="CreditLevel" VisibleIndex="15">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="CooperationLevel" VisibleIndex="16">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="FK_ContactKey" VisibleIndex="17">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Fakedelete" VisibleIndex="18">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="CreatePeople" VisibleIndex="19">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataDateColumn FieldName="CreateDate" VisibleIndex="20">
                </dxwgv:GridViewDataDateColumn>
                <dxwgv:GridViewDataTextColumn FieldName="ChangesPeople" VisibleIndex="21">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataDateColumn FieldName="ChangesDate" VisibleIndex="22">
                </dxwgv:GridViewDataDateColumn>
            </Columns>
        </dxwgv:ASPxGridView>

 

 

 aspxgridview的客户端事件

<ClientSideEvents SelectionChanged="function(s, e) {OnGridSelectionChanged();}" />

 

 

----js---

    function OnGridSelectionChanged() {
    grid.GetSelectedFieldValues('Customer_ID', OnGridSelectionComplete);
    }
    function OnGridSelectionComplete(values) {
    for(var i = 0; i < values.length-1; i ++) {
    grid.SelectRowsByKey(values[i],false);
    }    
    }

上一篇:kotlin调用终端命令


下一篇:ASPxGridView自适应高度设置