Solved

DevExpress - ASPXGridView - Limiting number of entries

Posted on 2010-11-15
9
1,560 Views
Last Modified: 2012-05-10
Hi,

Im using the AsPXGridView from DevExpress and Im wondering if it is possible to limit the number of entries in the grid. For example, the grid may start with no entries and the user clicks 'New' and creates an entry.

When the user has added the maximum number of entries the 'New' button is removed and only 'Edit' and Delete are visible.  If they Delete an entry then New is visible again etc.

Is this behaviour possible?
0
Comment
Question by:pize
9 Comments
 
LVL 3

Assisted Solution

by:Epitel0920
Epitel0920 earned 125 total points
ID: 34141371
Have a counter increment each time they hit a New button and decrement when they hit Delete.
On page load have if counter > some ammount NewButton.Visible = false; else newButton.Visible = true
0
 

Author Comment

by:pize
ID: 34141461
What Im really asking if this is intrinsic to the grid itself.  The Grid is smart enough to know when there arent any entries at all as you only get the 'New' button.  When there is one or more you get New/Edit/Delete.  Im wondering if there is a property like 'MaxEntries' that can be set on the grid so that the New/Edit/Delete behave accordingly when that maximum is reached
0
 
LVL 7

Assisted Solution

by:mr_nadger
mr_nadger earned 125 total points
ID: 34144273
not according to intellisense or the gridview properties list, as Epitel said your best bet is to hide the button, possibly on the insert event if the row limit's been reached.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview_properties.aspx

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Accepted Solution

by:
pize earned 0 total points
ID: 34160309
Im actually talking about the AsPXGridView from DevExpress and not Microsofts GridView control.  Turns out there is a CommandButtonInitialise event on this grid in which I can check the rows in the grid and hide the buttons accordingly
0
 
LVL 3

Expert Comment

by:Epitel0920
ID: 34160372
The desired result has also been sugested by me and mr_nadger, it is objectionable that the asker be allowed to close the question without giving us the points and keeping the question in the knowledge base, especially since he decided to change the essence of the question after getting a possible solution.
0
 

Author Comment

by:pize
ID: 34215097
Yes, I am relatively new here and yes I am aware that I can choose as many comments in the solution.  As I didnt implement the suggestions as 'the solution' how can I award the suggestions points?  I would need to implement those to make sure they worked in order to classify them as 'A Solution'.

The properties comment was talking about a totally different grid than the one I had asked about.

I would have thought that the solution you actually use is the one most relevant as that has had some form of testing done against it.

Anyway, Im not too fussed with what you want to do in regard to awarding points etc, happy to award the points as you described


0
 

Expert Comment

by:_alias99
ID: 34216253
All,
 
Following an 'Objection' by Epitel0920 (at http://www.experts-exchange.com/Q_26622855.html) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by  ModEErf.
 
At this point I am going to re-start the auto-close procedure.
 
Thank you,
 
_alias99
Community Support Moderator
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MVC DDL Json Not Binding to Model 2 25
Infrastructure development vs software development 3 60
"Emulate" TAB key when press Enter Key 3 44
asp.net mvc 2 20
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question