我想我的GridView列的值更改爲主動當值爲1 我有一個像如何訪問rowdatabound上的gridview列?
<asp:BoundField DataField="STATUS" HeaderText="STATUS" SortExpression="STATUS" HeaderStyle-HorizontalAlign="Left">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
</asp:BoundField>
和CS代碼gridview的列
protected void gvCategory_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[5].Text=="0")
{
e.Row.Cells[5].Text = "INACTIVE";
}
}
}
這是工作,但它會如果我更改列順序失敗。 我需要的是類似findControl函數的東西。 謝謝。
的第一個功能'GetCellByName',只應叫時,它的標題行類型:'e.Row.RowType == DataControlRowType.Header' – 2013-09-25 22:43:25
@DavidFreitas不這麼認爲。它使用給定單元格的基礎DataControlField。 – 2013-09-26 04:06:00