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

推荐订阅源

GbyAI
GbyAI
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
腾讯CDC
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
量子位
博客园 - 聂微东
Jina AI
Jina AI
小众软件
小众软件
The Cloudflare Blog
有赞技术团队
有赞技术团队
V
V2EX
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
B
Blog
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
宝玉的分享
宝玉的分享
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
N
Netflix TechBlog - Medium
I
InfoQ
J
Java Code Geeks
S
SegmentFault 最新的问题
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
D
DataBreaches.Net
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog RSS Feed
S
Schneier on Security
Webroot Blog
Webroot Blog
P
Proofpoint News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
Project Zero
Project Zero
Scott Helme
Scott Helme
C
CERT Recently Published Vulnerability Notes
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security

博客园 - 软件之美,美在缺陷-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句的写法,我特别喜欢。

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