Re: [问题] (sender As Object, e As EventArgs)

楼主: a926 (Aaron)   2016-01-27 10:10:44
※ 引述《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);
}
}

Links booklink

Contact Us: admin [ a t ] ucptt.com