Click here to Skip to main content
16,022,536 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
In run mode in gridview as follows

Appointment date

27 may 2015
30 may 2015
1 june 2015
empty row
25 may 2015
28 may 2015
30 may 2015
empty row

In the above gridview for empty row i want to display link button.

for that how can i do in asp.net using c#.
Posted
Comments
Thanks7872 24-Jul-15 2:08am    
Any efforts?

1 solution

Try this
on row databound check the row or cell is empty
add new link button control in that cell

protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if(string.IsNullOrEmpty(e.Row.Cells[0].Text))
{
// Or sometimes a no break space -  will work better
Button btn= new Button();
btn.Text = "view more";
e.Row.Cells[0].Controls.Add(btn);
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900