Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to make some changes to an app that a consultant started and am new to C#.

We're using a gridview to display data and the autogenerateeditbutton is set to true which works for most of the users. However, I do have some users that I need to be read-only.

Is there a way I can programmatically change the autogenerateeditbutton value depending on a flag I read in from my security database?

If not, is there another way to accomplish this without major re-programming?

Thanks in advance for any hints.
Posted
Comments
koool.kabeer 27-Jul-10 2:23am    
which application it is?, Web or Windows?

Sounds like you're asking an ASP.NET question.

First you need a way to decide which users have what rights - a permissions system. Then set your flag using a call to code behind, using the <% tags. Set the flag according to the user type. That's about it. If you're new to C#, and presumably new to ASP.NET, chances are you need to pay an experienced programmer to do the work, unless you're a quick study.
 
Share this answer
 
Are you asking if you can turn autogenerateeditbutton on/off based on some value? If so, you need to undertand the change will affect the whole gridview, not certain rows only

if the grid has

<asp:detailsview autogenerateeditbutton="True|False" xmlns:asp="#unknown" />

defined then remove it, then call

gridvie.AutoGenerateEditButton(), preferably on your PageLoad() method

See here for more details[^]
 
Share this answer
 
Thanks for the information. I do have a permissions table and am a pretty quick study. I've added on more logic to what the consultant started but hit this block. I'll search on samples of what you've suggested.
 
Share this answer
 
Comments
Toli Cuturicu 5-Aug-10 13:55pm    
Reason for my vote of 1
fake answer
I do want it to affect the entire grid based on a security table so I will dig into your remarks and link and see if I can get it working.

Thanks so much!
 
Share this answer
 
Comments
Toli Cuturicu 5-Aug-10 13:55pm    
Reason for my vote of 1
fake answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900