X
Xu ChunMing
Hi All,
I see the following on MSDN:
The DataGrid control supports several events. One of them, the ItemCreated
event, gives you a way to customize the item-creation process. The
ItemDataBound event also gives you the ability to customize the DataGrid
items, but after the data is available for inspection. For example, if you
were using the DataGrid control to display a to-do list, you could display
overdue items in red text, completed items in black text, and other tasks in
green text.
I nearly want to do the same thing,
but in the event ,I can't access the value I wanted with the commented
line, but this statemetn works well on the Item Updat event.
public void MyDataGrid_DataBound(Object sender, DataGridItemEventArgs e)
{
//string s1
=((System.Web.UI.WebControls.TextBox)e.Item.Cells[7].FindControl("edit_Sate"
)).Text;
if(s1=="UT")
e.Item.BackColor =Color.Green ;
}
I wonder how to access the one of the cell's bounded value of the just added
row.
Thanks!
I see the following on MSDN:
The DataGrid control supports several events. One of them, the ItemCreated
event, gives you a way to customize the item-creation process. The
ItemDataBound event also gives you the ability to customize the DataGrid
items, but after the data is available for inspection. For example, if you
were using the DataGrid control to display a to-do list, you could display
overdue items in red text, completed items in black text, and other tasks in
green text.
I nearly want to do the same thing,
but in the event ,I can't access the value I wanted with the commented
line, but this statemetn works well on the Item Updat event.
public void MyDataGrid_DataBound(Object sender, DataGridItemEventArgs e)
{
//string s1
=((System.Web.UI.WebControls.TextBox)e.Item.Cells[7].FindControl("edit_Sate"
)).Text;
if(s1=="UT")
e.Item.BackColor =Color.Green ;
}
I wonder how to access the one of the cell's bounded value of the just added
row.
Thanks!