views:

78

answers:

1

Hi

I have a gridview with data. Before filling the gridview i want to validate if column is Not null. If null i want to add control to gridview.

Is it possible

Thanks in advance

+1  A: 

you can do it in grid rowdatabound event.. like...

protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        System.Data.DataRowView dr = (System.Data.DataRowView)e.Row.DataItem;
        if (string.IsNullOrEmpty(dr["column"].ToString()))
        {
            //add your control or set visibility of ur control
        }
    }
}
Muhammad Akhtar