G
Gerald DeConto
I have a datagrid in my aspdotnet page where most columns are sortable.
I would like to be able to programatically set the ToolTip for each column
header to something like "Click here to sort by xxxxx" where xxxxx is the
column header name.
I dont want to manually hard code the xxxxx in the tooltip (pointless anyhow
if the columns are auto generated).
have tried to do a test of this via the datagrid ItemDataBound event like
this:
private void grdIncentive_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
e.Item.ToolTip = "Click here to sort by " +
e.Item.Cells[1].Controls[0].Text;
}
but VSS doesnt like the e.Item.Cells[1].Controls[0].Text (the solution does
not build and tells me:
'System.Web.UI.Control' does not contain a definition for 'Text'
HOWEVER, if I set the tooltip to some static string (ie "Foo") and debug the
page, I can set a watch variable to e.Item.Cells[1].Controls[0].Text and see
the value I want with no problem.
any help on getting this to work?? this should have taken me two minutes
and it is now going on two days.
all help appreciated.
I would like to be able to programatically set the ToolTip for each column
header to something like "Click here to sort by xxxxx" where xxxxx is the
column header name.
I dont want to manually hard code the xxxxx in the tooltip (pointless anyhow
if the columns are auto generated).
have tried to do a test of this via the datagrid ItemDataBound event like
this:
private void grdIncentive_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
e.Item.ToolTip = "Click here to sort by " +
e.Item.Cells[1].Controls[0].Text;
}
but VSS doesnt like the e.Item.Cells[1].Controls[0].Text (the solution does
not build and tells me:
'System.Web.UI.Control' does not contain a definition for 'Text'
HOWEVER, if I set the tooltip to some static string (ie "Foo") and debug the
page, I can set a watch variable to e.Item.Cells[1].Controls[0].Text and see
the value I want with no problem.
any help on getting this to work?? this should have taken me two minutes
and it is now going on two days.
all help appreciated.