GridView
protected void gvBBS_RowDataBound(object sender, GridViewRowEventArgs e) {
//定義一開始的網頁資料及狀態
if (e.Row.RowType == DataControlRowType.DataRow)
{
//使用版面內容
HyperLink hlkTitle = (HyperLink)e.Row.FindControl("hlkTitle");
if (hlkTitle != null)
hlkTitle.Text = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "bbs_title"));
hlkTitle.NavigateUrl = "BBSData.aspx?BBSNo=" + DataBinder.Eval(e.Row.DataItem, "bbs_bbsno");
}
}
Repeater
protected void rptBBS_ItemDataBound(object sender, RepeaterItemEventArgs e) {
if (e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
{
Button btnDeleteTitle = (Button)e.Item.FindControl("btnDeleteTitle");
if (btnDeleteTitle != null)
DelBtnSetup(btnDeleteTitle, "Title");
int lblno = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "lbl_lblno"));
}
}
沒有留言:
張貼留言