- 最後登錄
- 2023-5-8
- 在線時間
- 7 小時
- 註冊時間
- 2011-12-1
- 閱讀權限
- 20
- 精華
- 0
- UID
- 10604124
- 帖子
- 294
- 積分
- 47 點
- 潛水值
- 16940 米
| 本帖最後由 ggnnyy 於 2015-5-20 05:58 PM 編輯
後來我查到做法了,但還是非常謝謝你的回答喔^^
分享一下我的方式- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.Header) //標題列
- {
- }
- if (e.Row.RowType == DataControlRowType.DataRow) //資料列
- {
- e.Row.Height = 40;
- e.Row.Cells[0].Width = 120;
- e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
- e.Row.Cells[1].Width = 350;
- HyperLink lnk = new HyperLink();
- lnk.Text = e.Row.Cells[1].Text;
- lnk.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(128)))));
- lnk.Font.Underline = false;
- lnk.NavigateUrl = "活動內容.aspx?ActiveDate=" + e.Row.Cells[0].Text + "&ActiveTopic=" + e.Row.Cells[1].Text;
- e.Row.Cells[1].Controls.Add(lnk);
- e.Row.Cells[2].Width = 80;
- e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Center;
- }
- }
複製代碼 ... |
|