在ASP.net中仅编辑/更新和删除搜索结果 [英] Edit/Update and Delete only Searched Results in ASP.net
本文介绍了在ASP.net中仅编辑/更新和删除搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的ASP页中有一个搜索控件,该控件在GridView中显示搜索到的结果.目前,我可以编辑/更新/删除搜索结果,但数据库中的所有行都将返回以在Gridview中进行编辑/更新和删除
如何仅将我的编辑/更新/删除限制为在Gridview中显示的搜索结果?
我正在手动用C#编写代码.
谢谢,
Hi There,
I have a search control in my ASP page which displays my searched results in GridView. Currently I can edit/update/delete a searched result but all the rows in my database is returned for editing/updating and deleting in my Gridview
How do I only restrict my edit/update/delete to the results I''ve searched on which are displayed in Gridview?
I am coding in C# manually.
Thanks,
推荐答案
您想限制对gridview权限的编辑/删除操作.
然后将showditebutton,updatebutton属性设置为false,因此gridview中没有编辑按钮
我对您的问题是否正确.
Hi,
you want to restrict to edit/delete operations for gridview right.
then set showeditebutton,updatebutton properties to false .so there is no edit buttons in gridview
Am I correct in your question.
然后做一件事来更改搜索记录的标志.
在检索记录以进行编辑/删除时,选择与标志值匹配的记录
在数据库表中使用一个标志
并更改该标志(如果已编辑,更新,删除),
因此在执行操作时,可以通过禁用特定的行按钮或发出警报来限制他.
您需要将该标志作为gridview中的隐藏字段.
then do one thing change the flag for the searched records.
while retrieving the records for edit/delete select the records those match to flag value
use one flag in your database table
and change the flag if it is edited,updated,deleted ,
so while you are doing operations restrict him by disabling that particular rows buttons or by raising an alert.
you need to get that flag as a hidden field in your gridview.
<asp:GridView>
<asp:TemplateField>
<itemtemplate>
<asp:HiddenField ID="htFlag" runat="server" value="bind from database"/>
<asp:TextBox ID="txtvalue" runat="server" text="bind from database"/>
</itemtemplate>
在行命令中找到隐藏的字段,然后根据状态可以完成您的工作
in row command find the hidden field and depend upon the status u can do your stuff
这篇关于在ASP.net中仅编辑/更新和删除搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文