PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
C_Sharp
[問題] GridView的ButtonField
作者:
coldwind7810
2014-02-24 23:26:05
不好意思又要打擾各位了。
目前我asp.net的程式碼架構如下:
private void showResults(string[,] itemInformation, bool[] results)
{
DataTable dtRecommend = new DataTable("Item");
dtRecommend.Columns.Add(new DataColumn("標題", typeof(string)));
dtRecommend.Columns.Add(new DataColumn("摘要", typeof(string)));
dtRecommend.Columns.Add(new DataColumn("連結", typeof(string)));
DataRow row = dtRecommend.NewRow();
for (int i = 0; i < results.Length; i++)
{
if (results[i] == true)
{
row["標題"] = itemInformation[i,0];
row["摘要"] = itemInformation[i,1];
row["連結"] = itemInformation[i,2];
dtRecommend.Rows.Add(row);
}
}
GridView.DataSource = dtRecommend;
GridView.DataBind();
}
目前我的問題是我希望把"連結"那一欄用ButtonField取代,並把超連結的資料用新分頁
的方式開啟。
我有在GridView新增ButtonField的欄位,並設定好了CommandName,也有找到要判別
是否按到ButtonField並啟動需要用到GridView_RowCommand這個事件。
但我該如何把我超連結的值塞到按鈕中並觸動事件開啟新分頁。
先感謝各位的幫忙了
作者:
m339606
(mize)
2014-02-24 23:42:00
Gv.Row[x].Cell[y].Text = "<a href='' target='_new'>";用一般的欄位,直接把html弄上去就好,省PostBack的資源<a href='
http://xxx'
target='_new'>Google This</a>
繼續閱讀
[問題] jquery + 泛型處理常式or webService問
tloy1966
[問題] 請教c#資料庫的使用
youneverknow
[問題] 初心者不會用Visual Studio 2012 打C#
nature23306
[問題] 多個textbox運算
ji3345
[問題] winform in web
g66932007
[問題] 請問陣列找最小值及秀圖問題
garnett0512
[問題] C# string to DateTime
Anthony53
[問題] WebService可以收JSon型別的參數嗎?
cavitylapper
Re: [問題] 動態更新Label值
Anthony53
[問題] 請問gridview可以ctrl+v嗎?
kevin888
Links
booklink
Contact Us: admin [ a t ] ucptt.com