Solved

DevExpress - ASPXGridView - Limiting number of entries

Posted on 2010-11-15
9
1,549 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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