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

推荐订阅源

F
Fortinet All Blogs
MyScale Blog
MyScale Blog
Microsoft Security Blog
Microsoft Security Blog
量子位
B
Blog
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
T
The Exploit Database - CXSecurity.com
N
News | PayPal Newsroom
Cloudbric
Cloudbric
A
About on SuperTechFans
AI
AI
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
H
Heimdal Security Blog
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
IT之家
IT之家
Know Your Adversary
Know Your Adversary
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
博客园 - 叶小钗
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
The Hacker News
The Hacker News
Y
Y Combinator Blog
I
Intezer
The Register - Security
The Register - Security
F
Full Disclosure
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler

博客园 - 戴玮

关于状态模式的思考 实在是忍受不了MSN的巨慢速度,重新换个地方 如果在网页中实现查找功能 asp.net2.0 页面生命周期方法 C#加密与解决 ASP.NET常用的代码集合 - 戴玮 - 博客园 触发器示例代码 ADO.NET2.0分页 - 戴玮 - 博客园 如何查找 Office Web 组件 (OWC) 编程文档和示例 如何将枚举定义翻译成DataTable 网页中调用MSN添加好友工具 如何在XP SP2下面使用DTC Javascript 复制与粘贴 - 戴玮 - 博客园 如何在Component中取得Page对象 使用TransactionScope进行COM+事务处理 - 戴玮 - 博客园 如何在C#中使用EVAL方法 - 戴玮 - 博客园 巨NB的JAVASCRIPT代码 - 戴玮 - 博客园 9月25日C#->WebService中如何传递文件 解决了一年多的问题,狂喜(一年之前)
如何自定义一个模板列,并在后台加载
戴玮 · 2006-11-15 · via 博客园 - 戴玮

public class EditTemplateColumn : ITemplate
{
    public EditTemplateColumn(string colname)
    {
        m_strColName = colname;
    }

    public void InstantiateIn(Control container)
    {
        Label edt = new Label();
        edt.DataBinding += new EventHandler(this.OnDataBinding);

        container.Controls.Add(edt);
    }

    public void OnDataBinding(object sender, EventArgs e)
    {
        Label edt = (Label )sender;

        DataGridItem container = (DataGridItem)edt.NamingContainer;
        edt.Text = DataBinder.Eval(container, "DataItem." + this.m_strColName).ToString();
       // edt.Text = ((DataRowView)container.DataItem)[m_strColName].ToString();
    }

    private string m_strColName;
}

加载

 protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        TemplateColumn obj = new TemplateColumn();

        obj.ItemTemplate = new EditTemplateColumn("Birthday");
        obj.HeaderText = "itemTemplete";
       
        this.DataGrid1.Columns.Add(obj);
    }