站內文章

2014年10月16日 星期四

隱藏gridview欄位



gridview 建一個 RowCreated

// 條件可另行設定
// 主要程式碼為 e.Row.Cells[10].Visible = false; 

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        //如果 radiobutton 選擇了 已核准, 則隱藏 刪除欄位(第十個column)
        if (RadioButtonList1.SelectedValue == "已核准") 
        {
            e.Row.Cells[10].Visible = false; 
        }
    }


沒有留言:

張貼留言