Ok so for this senerario you cannot hide or show columns you can set the Other Columns Values to blank if the Paid Column Value is No. So to do this you will first have to bind the columns in the design like this
<form id="form1" runat="server">
<div>
<asp:DataGrid ID="dvDataGrid" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundColumn DataField="name" HeaderText="Name" />
<asp:BoundColumn DataField="address" HeaderText="Address" />
<asp:BoundColumn DataField="phone" HeaderText="Phone" />
<asp:BoundColumn DataField="emailid" HeaderText="EmailId" />
<asp:BoundColumn DataField="website" HeaderText="WebSite" />
<asp:BoundColumn DataField="remarks" HeaderText="Remarks" />
<asp:BoundColumn DataField="paid" HeaderText="Paid" />
</Columns>
</asp:DataGrid>
</div>
</form>
Now after binding the columns you will have to write the following codes
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[7] { new DataColumn("name"), new DataColumn("address"), new DataColumn("phone"), new DataColumn("emailid"), new DataColumn("website"), new DataColumn("remarks"), new DataColumn("paid") });
dt.Rows.Add("ABC", "Maharashtra", "123456789", "a@a.com", "www.abc.com", "Good", "Yes");
dt.Rows.Add("CDE", "Gujarat", "987654321", "b@b.com", "www.cde.com", "Fair", "No");
dt.Rows.Add("FGH", "Kerala", "147852369", "c@c.com", "www.fgh.com", "Excellent", "Yes");
dt.Rows.Add("IJK", "AndhraPradesh", "369852147", "d@d.com", "", "Average", "No");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["paid"].ToString().Trim().ToUpper() == "NO")
{
dt.Rows[i]["address"] = "";
dt.Rows[i]["emailid"] = "";
dt.Rows[i]["website"] = "";
dt.Rows[i]["remarks"] = "";
}
}
dvDataGrid.DataSource = dt;
dvDataGrid.DataBind();
so in the above code i have first loaded the data in datatable and based on you paid column value i have set the other columns data to blank. The only thing you will have to do is you will have to bind the datatable from the database and than you will have to follow the below code.