protected void GvDisplayDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(gvDisplayDocuments,
"Select$" + e.Row.RowIndex);
var lastCell = e.Row.Cells.Count - 1;
var index = e.Row.RowIndex;
e.Row.Cells[lastCell].ToolTip = _docList[index].DrawingTitle;
}
}
This worked perfectly for a vanilla GridView, but failed once I turned paging on, so I modified index to:
var recordsPerPage = myGridView.PageSize;
var index = (recordsPerPage * _currPage) + e.Row.RowIndex;
where _currPage is set from the PageIndexChanging event to e.NewPageIndex. This works for paging now, but turning on Sorting kills it because the row index doesn't change OnSorting, so the ToolTips still reflect the original sort order. I couldn't figure out how to attach the full title to the cell and only display a specific number of chars/words, so I don't know how to fill the tooltip other than by matching row index to the list index. Anyone have any ideas?
NOTE: Sorting isn't a project requirement (and wasn't available in the previous incarnation of the site), it's just a feature I think we should provide, so if there aren't any semi-elegant solutions I'll just can it.

New Topic/Question
Reply




MultiQuote





|