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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
AWS News Blog
AWS News Blog
Google DeepMind News
Google DeepMind News
U
Unit 42
博客园 - 叶小钗
博客园 - 聂微东
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
美团技术团队
The Cloudflare Blog
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
S
Schneier on Security
C
Check Point Blog
Project Zero
Project Zero
The Hacker News
The Hacker News
Scott Helme
Scott Helme
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cisco Talos Blog
Cisco Talos Blog
P
Privacy International News Feed
SecWiki News
SecWiki News
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
H
Help Net Security
TaoSecurity Blog
TaoSecurity Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Last Week in AI
Last Week in AI
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
T
The Exploit Database - CXSecurity.com
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
大猫的无限游戏
大猫的无限游戏
T
Troy Hunt's Blog
H
Hacker News: Front Page
Vercel News
Vercel News

博客园 - lrary

JavaScript经典技巧 - lrary - 博客园 动态添加ASP.NET控件并绑定处理事件一例 - lrary - 博客园 脚本收藏 - lrary - 博客园 一些sql语句的详细解释[转] 纯脚本搞掂DataGrid表表头不动,表身滚动。(转摘) - lrary - 博客园 检验密码强度的JS类 - lrary - 博客园 数据库设计规范 V2.0 SQL语句特---殊统计(1) DataGrid 多行 DataGrid怎么产生一个分类的题头 AJAX 在.net的应用 sql怎么使用外连接 Asp.NET程序中常用的三十三种代码 检测含有中文字符串的实际长度 根据区位得到汉字拼音首字母(c#) 认识ASP.NET配置文件Web.config Asp.net(C#)实现验证码功能 给Repeater、Datalist和Datagrid增加自动编号列 查找和统计页面上控件
特殊的DataGrid的绑定 - lrary - 博客园
lrary · 2006-05-30 · via 博客园 - lrary

页面上:

<asp:datagrid id="DataGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="100%"
                                DataKeyField
="bh" PageSize="10" BorderWidth="1px" BorderColor="#9BA6DB">
                                
<AlternatingItemStyle CssClass="zy_tr"></AlternatingItemStyle>
                                
<ItemStyle CssClass="zy_item"></ItemStyle>
                                
<HeaderStyle CssClass="zy_title"></HeaderStyle>
                                
<Columns>
                                    
<asp:BoundColumn Visible="False" DataField="wdlb" HeaderText="序号"></asp:BoundColumn>
                                    
<asp:TemplateColumn>
                                        
<HeaderTemplate>
                                            序号
                                        
</HeaderTemplate>
                                        
<ItemTemplate>
                                            
<%# Container.DataSetIndex + 1 %>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                    
<asp:TemplateColumn HeaderText="文档名称">
                                        
<ItemTemplate>
                                            
<asp:HyperLink id="HyperLink1" runat="server">
                                                
<%# DataBinder.Eval(Container.DataItem,"wdmc")%>
                                            
</asp:HyperLink>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                    
<asp:BoundColumn DataField="ytfl" HeaderText="用途分类"></asp:BoundColumn>
                                    
<asp:BoundColumn DataField="bx_mc" HeaderText="必须"></asp:BoundColumn>
                                    
<asp:BoundColumn DataField="zt_mc" HeaderText="状态"></asp:BoundColumn>
                                    
<asp:TemplateColumn HeaderText="操作">
                                        
<ItemTemplate>
                                            
<asp:CheckBox id="record" runat="server"></asp:CheckBox>
                                        
</ItemTemplate>
                                    
</asp:TemplateColumn>
                                
</Columns>
                                
<PagerStyle Visible="False"></PagerStyle>
                            
</asp:datagrid>

后台:

 1 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 2         {
 3         
 4             if(e.Item.ItemType!=ListItemType.Header&&e.Item.ItemIndex>=0)
 5             {    
 6                 if(e.Item.Cells[0].Text=="1")
 7                 {
 8                     ((CheckBox)e.Item.Cells[0].FindControl("record")).Visible=true;
 9                 }
10                 else
11                 {
12                     ((CheckBox)e.Item.Cells[0].FindControl("record")).Visible=false;
13                 }
14                 try
15                 {
16                     HyperLink link1=((HyperLink)e.Item.FindControl("HyperLink1"));
17                     link1.NavigateUrl="add.aspx?bh="+DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
18                 }
19                 catch(Exception e1)
20                 {
21                     Response.Write(e1.Message.ToString());
22                 }
23     
24                 
25             }
26         }