惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
D
DataBreaches.Net
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
Recent Announcements
Recent Announcements
The Register - Security
The Register - Security
S
Secure Thoughts
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
V2EX - 技术
V2EX - 技术
腾讯CDC
GbyAI
GbyAI
G
Google Developers Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
Help Net Security
Help Net Security
K
Kaspersky official blog
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
AI
AI
MongoDB | Blog
MongoDB | Blog
Scott Helme
Scott Helme
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
H
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
S
Security Affairs
TaoSecurity Blog
TaoSecurity Blog
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
Martin Fowler
Martin Fowler
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI

博客园 - 软件之美,美在缺陷-Johnson

如何:在OpenText Workflow 6.5模型中保存和读取多行数据 轻松部署Captaris Workflow 6.5模型 浅比.NET和Java开发工具。 .NET资源转换工具 排除大型工作流应用的性能问题纪要。 淘宝网一家店里看到的留言和掌柜的搞笑回复。 Windows Network Load Balancing群集故障排除手记。 Captaris Workflow 6.0 EventService 执行效率低下的排除。 Captaris Workflow开发系列课程介绍。 在虚拟机里System进程占用CPU100%的问题解决 如何做好售前技术支持工作 一家公司网站上的招聘人才招聘栏目 VMWare 5.5 虚拟机错误。 Your've got mail A new post form Microsoft Live Writer. How to: Debug Captaris Workflow 6.0 Process efficiency? How to: Debug Captaris Workflow 6.0 Process efficiency? Captaris Workflow 6.0问题两则。 Recently learning about AJAX on ASP.NET
在GridView中使用ModalPopupExtender(转)
软件之美,美在缺陷-Johnson · 2007-05-28 · via 博客园 - 软件之美,美在缺陷-Johnson

原文出处

当你不想在在GridView(或任何其它数据列表的控件中,如DataGrid/DataList等)编辑行时,有几种做法:

1.传递参数到另一个页面,在新的页面中进行修改;

2.获取GridView中选

择的行,在当前页面的另一些控件中显示控件并进行修改;

3.使用iFrame,直接在当前页嵌入另一个页面进行修改。

现在我们有了新的选择--使用ModalPopupExtender进行编辑,这个思路与第2点类似,只是增强了用户的视觉效果,使得用户在同一时间只能关注一个操作。

应用于GridView时,有一些需要注意的地方:

1.TargetControlID的设置,由于TargetControlID是必须设置的,而你希望在用户点击GridView中的某个Button或LinkButton或ImageButton时才使ModalPopup出现。可以这样,在页面上放置一个Button控件,通过设置Style="display: none;"隐藏这个控件。如:

         <asp:Button ID="btnHiddenPerson" runat="Server" Style="display: none" />

2.OKControlID的设置,你无需设置ModalPopupExtender的OKControlID属性。因为一旦设置了OKControlID,此控件的服务器OnClick事件便不会触发。相对应的,你应该设置CancelControlID属性。

3.GridView按钮事件的设置,因为事件是从GridView中的控件引发的,因此不可避免要到服务器端跑一次。你可以设置引发事件的Button事件不在OnRowCommand事件中处理,而是专门响应一个Button_Click事件来处理。如:

LinkButton btnApprove = sender as LinkButton;
GridViewRow row = (GridViewRow)btnApprove.NamingContainer;
Label lblRequestAmount = (Label)row.FindControl("lblAmount");
Label lblApproveAmount = (Label)row.FindControl("lblApprovedAmount");
this.lblOriginAmount.Text = lblApproveAmount.Text;
this.lblOriginRequestAmount.Text = lblRequestAmount.Text;
this.lblCurrentRowIndex.Text = row.RowIndex.ToString();
this.ModalPopupExtender.Show();

请注意其中第2句的写法,我特别喜欢。

示例代码请从原文处下载。