How fix the column width in a gridview at insert tooltip in each cell in Asp.net 4?

If you need to set the width of each column in a gridview control, If the column is just to display and no editing needed. You can like this,

FixColumnWidth1

But if there is a editing to be done, you need to do like this,

FixColumnWidth2

If you need insert a tooltip for each cell inside a gridview, you need to set each column tooltip. You can do like this,

protected void gv_DataBound(object sender, EventArgs e) { Label lbl = new Label(); foreach (GridViewRow rv in gv.Rows) { lbl = (Label)rv.FindControl("lblGridColumnName "); rv.Cells[1].ToolTip = lbl == null ? string.Empty : lbl.Text; } }

Advertisements
This entry was posted in ASP.NET 4, C# 4.0, C# 4.0 AND ASP.NET 4.0, CSS. Bookmark the permalink.

One Response to How fix the column width in a gridview at insert tooltip in each cell in Asp.net 4?

  1. oqihm says:

    Great stuff you got there!
    I have been reading your blogs since I was a lil’ boy. They’re very helpful. 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s