//exd_stauts 欄位 不會出現在GRIDVIEW內顯示,
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//在每一列找到資料欄位
object dataItem = e.Row.DataItem;
string exd_stauts = (string)DataBinder.Eval(dataItem, "exd_stauts");
//在每一列找到RadioButton元件
RadioButton rbNotOK = e.Row.FindControl("rbNotOK") as RadioButton;
RadioButton rbOK = e.Row.FindControl("rbOK") as RadioButton;
//資料欄位與RadioButton元件
if (exd_stauts == "0")
{ rbNotOK.Checked = true; rbOK.Checked = false; }
else
{ rbNotOK.Checked = false; rbOK.Checked = true; }
}
}
//這裡還有顯示如何在cell內部加上JavaScript連接
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
object dataItem = e.Row.DataItem;
string url = "'../waBack/wfmembe.aspx?GetPkey=" + DataBinder.Eval(dataItem, "m_pkey") + "'";
url = "window.open(" + url + ", '會員', config='width=1024,height=768,scrollbars=yes');";
e.Row.Cells[1].Attributes.Add("ondblclick", "javascript:" + url);
e.Row.Cells[2].Attributes.Add("ondblclick", "javascript:" + url);
object dataItem = e.Row.DataItem;
string exd_stauts = (string)DataBinder.Eval(dataItem, "exd_stauts");
e.Row.Cells[7].Text = exd_stauts;
}
}