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

[Solved] Set a maximum amount for grid

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 2
Darren asked on 15 Jun 2009, 03:49 PM
Hi There,

Is there a way to only allow a certain amount of records to be added using a Radgrid?
Say a user can only add a max of 10 records within the grid.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 15 Jun 2009, 04:54 PM
Hello Darren,

Please try the following approach:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == RadGrid.InitInsertCommandName) 
    { 
        if (e.Item.OwnerTableView.Items.Count > 9) 
            e.Canceled = true
    } 

Let me know if you have any questions.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Darren
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or