2012-04-17 90 views
0

我在我的解決方案中使用了radgrid。我使用這個radgrid拖放數據,但不需要選擇。因此,當用戶點擊一行時,該行不應將其佈局更改爲選定的行。但是,當我禁用選擇,拖放不再工作。這不是那種問題,但它至少對用戶是不可見的,因爲有些用戶可能會感到困惑。網格選擇禁用/不可見

有沒有一種方法可以禁用選擇,但不斷拖動或刪除或覆蓋/刪除所選行的CSS?

預先感謝您!

親切的問候, 韋斯利

example

<telerik:RadGrid ID="rgData" runat="server" AutoGenerateColumns="False" AllowMultiRowSelection="false" CellSpacing="0" GridLines="None" onrowdrop="rgData_RowDrop"> 
    <ClientSettings AllowRowsDragDrop="True" EnablePostBackOnRowClick="true"> 
     <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
+0

你能發表相關的代碼嗎?這會讓事情變得更容易。 – 2012-04-17 12:55:50

回答

0

你有兩個選擇,你可以做,這將解決您的問題。你是對的,認爲你應該改變CSS而不是試圖禁用選擇。方法1(如果你不使用皮膚)是使用itemStyle和SelectedItemStyle元素,它們具有你需要設置的所有屬性。

<telerik:RadGrid ID="rgData" runat="server" AutoGenerateColumns="False" AllowMultiRowSelection="false" CellSpacing="0" GridLines="None" onrowdrop="rgData_RowDrop"> 
    <SelectedItemStyle BackColor="AliceBlue" /> 
    <ItemStyle BackColor="AliceBlue" /> 
    <ClientSettings AllowRowsDragDrop="True" EnablePostBackOnRowClick="true"> 
     <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 

或者,如果你正在使用的皮膚,在radgrid控件設置EnableEmbeddedSkins="false"和複製skins目錄到你的項目,並修改爲皮膚下面的風格你使用:

的文件應該是如:RadControls/Grid/Skins/[SkinName] /Styles.css文件。

.RadGrid_[SkinName] .rgSelectedRow 
    { 
     background: #e5e5e5 !important; 
     height: 22px; 
     border: solid 1px #e5e5e5; 
     border-top: solid 1px #e9e9e9; 
     border-bottom: solid 1px white; 
     padding-left: 4px; 
    }