This is a migrated thread and some comments may be shown as answers.

problem with commanditemTemplate

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ambuj
Top achievements
Rank 1
Ambuj asked on 30 Jun 2010, 12:51 PM

Hi,

I am using telerik radgrid with the Command item Insert/Update/Delete
Few issue i have experienced

Please check against the following link.

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/commanditem/defaultcs.aspx

Add Case:-

1) When I click on the AddNew button ,below option is comming in the header
   Please tell me how to remove Edit Selected and Delete selected customer from here ,also can you tell me what's the use of these button when we are adding a new customer.

Custom command item template     Edit selected      Cancel editing       Add this Customer   Delete selected customers   Refresh customer list 

 

Edit Case.(Single row select)

2) If we doesn't select any row before clicking on the EditSelected button,can we show a popup saying that "Please select the customer to edit."(like Delete case.)

Please

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Jun 2010, 02:23 PM
Hello,

1.
Have you tried setting the Visible property for the button as shown below?
      Visible='<%# RadGrid1.EditIndexes.Count > 0 || !(RadGrid1.MasterTableView.IsItemInserted) %>'

2.
Attach OnClientClick method for EditSelected button and you can check for the selectedItems from client side to show confirm.
    <asp:LinkButton ID="btnEditSelected" runat="server" OnClientClick="return check();"  . . .>

Use the 'get_selectedItems()' method to check whether any item is currently selected or not.
Here is the sample code:
 
function check() {  
    var grid = $find("<%= RadDtpDOB.ClientID %>");  
    var masterTable = grid.get_masterTableView();      
    if (masterTable.get_selectedItems().length >0) {  
         // Show confirm   
         // return result  
    }  

 

Hope this information helps,
Princy.
Tags
Grid
Asked by
Ambuj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or