J
Jo
Hi all,
I have a gridview displaying a dataset and some buttons. When a certain
cell of this datasetrow is empty, I want a button in that row to be
visible, otherwise no button should be shown in that row.
I'm trying to make this work all day, but it's not going to work.
I tried this in the rowCreated event. I am able to find the right row
and cell in this row (as a datarow), but now the right gridview
row-cell should be made visible.
This is what I have right now (C#):
protected void supplierFilesGrid_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView drView = (DataRowView)e.Row.DataItem;
DataRow drRow = drView.Row;
if (drRow[2].ToString() == "NEW")
{
int i = e.Row.RowIndex; //
this works fine, after this I get an error:
//grid.Rows.Cells[1].Visible = false; //
argumentOutOfRangeException...
(sender as GridView).Rows.Cells[1].Visible =
false;
}
}
}
Has anyone a suggestion how to make this work?
Thanks in advance!
Regards,
Jo
I have a gridview displaying a dataset and some buttons. When a certain
cell of this datasetrow is empty, I want a button in that row to be
visible, otherwise no button should be shown in that row.
I'm trying to make this work all day, but it's not going to work.
I tried this in the rowCreated event. I am able to find the right row
and cell in this row (as a datarow), but now the right gridview
row-cell should be made visible.
This is what I have right now (C#):
protected void supplierFilesGrid_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView drView = (DataRowView)e.Row.DataItem;
DataRow drRow = drView.Row;
if (drRow[2].ToString() == "NEW")
{
int i = e.Row.RowIndex; //
this works fine, after this I get an error:
//grid.Rows.Cells[1].Visible = false; //
argumentOutOfRangeException...
(sender as GridView).Rows.Cells[1].Visible =
false;
}
}
}
Has anyone a suggestion how to make this work?
Thanks in advance!
Regards,
Jo