作者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://www.ptt.cc/bbs/Programming/M.1453860652.A.AB1.html
推 yzfr6: 取 datagridview 的 rowindex 也很好用 117.25.120.21 01/28 18:53
推 penut85420: 取鍵盤按鍵輸入就用的到 1.167.156.26 02/01 19:19