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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
V
V2EX
G
Google Developers Blog
F
Full Disclosure
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
H
Hacker News: Front Page
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
NISL@THU
NISL@THU
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
About on SuperTechFans
The Cloudflare Blog
C
Cisco Blogs
D
DataBreaches.Net
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Vercel News
Vercel News
P
Privacy International News Feed
Microsoft Security Blog
Microsoft Security Blog
Help Net Security
Help Net Security
Recorded Future
Recorded Future
PCI Perspectives
PCI Perspectives
S
Schneier on Security
AI
AI
N
News | PayPal Newsroom
雷峰网
雷峰网
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Schneier on Security
Schneier on Security
S
Securelist
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
AWS News Blog
AWS News Blog
TaoSecurity Blog
TaoSecurity Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 三生石上(FineUI控件)
C
CXSECURITY Database RSS Feed - CXSecurity.com
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cloudbric
Cloudbric
C
Cybersecurity and Infrastructure Security Agency CISA
Project Zero
Project Zero
C
Check Point Blog
S
Security Affairs

博客园 - 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         }