2013-10-24 43 views
0

有沒有合併這兩列的方法?這就是我現在所擁有的 enter image description here。這是我如何創建這兩列從代碼隱藏合併編輯和刪除Radgrid中的列

     GridEditCommandColumn EditColumn = new GridEditCommandColumn(); 
         this.RadGrid1.MasterTableView.Columns.Add(EditColumn); 
         EditColumn.ButtonType = GridButtonColumnType.ImageButton; 
         EditColumn.UniqueName = "EditCommandColumn"; 
         EditColumn.HeaderText = "SingleAction"; 
         EditColumn.ColumnGroupName = "test"; 

         GridButtonColumn DeleteColumn = new GridButtonColumn(); 
         this.RadGrid1.MasterTableView.Columns.Add(DeleteColumn); 
         DeleteColumn.CommandName = "Delete"; 
         DeleteColumn.ButtonType = GridButtonColumnType.ImageButton; 
         DeleteColumn.UniqueName = "DeleteCommandColumn"; 
         DeleteColumn.ConfirmDialogType = GridConfirmDialogType.Classic; 
         DeleteColumn.HeaderText = "SingleAction"; 
         DeleteColumn.ConfirmText = "Do you really want to delete?"; 

現在我要實現這樣的 enter image description here 我試圖做GridCalculatedColumn這樣

GridCalculatedColumn calcol = new GridCalculatedColumn();
calcol.DataFields =new string[]{"EditCommandColumn","DeleteCommandColumn"};
calcol.Expression ="{0}-{1}";
tableViewProjects.Columns.Add(calcol);

但是,我無法達到我想要的。我得到一個錯誤列[EditCommandColumn]不存在,我認爲這是有道理的,因爲它不是數據庫中的數據字段。 那麼,有沒有辦法做到這一點。

請幫幫忙, 預先感謝您

回答

0

的Telerik的radgrid控件是「某種」數據網格,並提供相同的選項

這些選項之一是ItemTemplate中。

您可以將任何html元素放在該模板中。此代碼是從回答被盜:asp.net gridview: How can I have multple button fields in one column?

也應與Telerik的

工作
<ItemTemplate> 
       <asp:LinkButton ID="btnApprove" runat="server" CommandName="Approve" Text="Approve" /> 
       <asp:LinkButton ID="btnDeny" runat="server" CommandName="Deny" Text="Deny" /> 
       <asp:LinkButton ID="btnReturn" runat="server" CommandName="Return" Text="Return" /> 
      </ItemTemplate> 

更多「Telerik的具體的」幫助「 radgrid控件的ItemTemplate」應該可以幫助您在Telerik的知識庫