The following code in my onitemcreated works for some item rows in my
datagrid, but not others. I am trying to set a linkbutton visible for
downloading a file if the data is available in the database, otherwise
set a "not available" label visible. The outcome is that for the first
row on my datagrid, the linkbutton is visible, for the second row both
the linkbutton *and* the label are visible and for the third row, again
only the linkbutton is visible:
private void OnItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item)
{
if(DataBinder.Eval(e.Item.DataItem,"RESULT") == DBNull.Value)
((LinkButton)e.Item.Cells[10].FindControl("lbtnDownload")).Visible =
false;
else
((Label)e.Item.Cells[10].FindControl("lblNotAvailable")).Visible =
false;
}
}
Thanks in advance.
Adam Smith
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!