C#Gridview-控制autogenerateeditbutton [英] C# Gridview - controlling autogenerateeditbutton
问题描述
我正在尝试对顾问启动的应用程序进行一些更改,这些应用程序是C#的新手.
我们正在使用gridview来显示数据,并且autogenerateeditbutton设置为true,这对大多数用户都适用.但是,我确实有一些需要只读的用户.
有没有一种方法可以根据我从安全性数据库中读取的标志来以编程方式更改autogenerateeditbutton的值?
如果没有,是否有另一种方法可以在不进行大量重新编程的情况下完成此任务?
在此先感谢您提供任何提示.
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.
推荐答案
听起来像是在问ASP.NET问题.
首先,您需要一种方法来决定哪些用户具有哪些权限-权限系统.然后使用<%标记通过调用代码来设置您的标志.根据用户类型设置标志.就是这样.如果您是C#的新手,或者大概是ASP.NET的新手,那么除非您是快速学习的人,否则您有可能需要聘请经验丰富的程序员来从事这项工作.
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.
您是否在问是否可以根据某些值打开/关闭自动生成编辑按钮?如果是这样,则需要了解所做的更改将影响整个gridview,而不仅限于某些行
如果网格具有
<asp:detailsview autogenerateeditbutton="True|False" xmlns:asp="#unknown" />
定义,然后将其删除,然后调用
gridvie.AutoGenerateEditButton()
,最好在您的PageLoad()方法上
详情请参见此处详细信息 [ ^ ]
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[^]
感谢您提供信息.我有一个权限表,可以快速学习.我在顾问开始时添加了更多逻辑,但遇到了障碍.我将搜索您建议的示例.
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.
这篇关于C#Gridview-控制autogenerateeditbutton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!