作者a926 (Aaron)
看板Programming
标题Re: [问题] (sender As Object, e As EventArgs)
时间Wed Jan 27 10:10:44 2016
※ 引述《Tripadvisor (探险家)》之铭言:
: e As EventArgs,网路上查到 e是事件的参数 (完全看不懂)
: 又说这个东西实际用不太到,可我真的很想知道EventArgs到底
: 是甚麽东西啊! 我可以用这个参数做甚麽 ?
很多阿!当你在某个方法(事件)。想额外取用特定物件的时候就很好用
我顺手找了一下,MSDN已经很佛心的帮你列出来了,你只要点进去看就知道能干啥用了
https://msdn.microsoft.com/en-us/library/system.eventargs(v=vs.110).aspx
以GridView来说,我会在RowCreated这个方法里,透过GridViewRowEventArgs
来让我判断是不是表头。然後我才能做一些额外的处理
其它就看你的情境了 :)
protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)
{
TableCellCollection cells = e.Row.Cells;
if (e.Row.RowType == DataControlRowType.Header)
{
cells[0].Text = "核心能力";
cells[1].Text = "比重";
cells[1].Attributes.Add("style", separateLine);
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.253.229.243
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Programming/M.1453860652.A.AB1.html
1F:推 yzfr6: 取 datagridview 的 rowindex 也很好用 117.25.120.21 01/28 18:53
2F:推 penut85420: 取键盘按键输入就用的到 1.167.156.26 02/01 19:19