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