|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
August 30th, 2004, 12:55 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Tooltip in datagrid
Hi,
I would like to set tool tips for the data grid column. The
functionality should allow an help tooltips to be displayed whenever
the user moves mouse over each column.
Lily
|
August 30th, 2004, 02:01 PM
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
every webcontrol has a string property that called ToolTip,
you can set this property for every DataGridItem object ...
or you can bind it(i.e to a column in your datasource) in ItemTemplate
HtH.
--------------------------------------------
Mehdi.:)
|
August 31st, 2004, 06:51 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I can the property with datagrid but how to set with a particular column of the datagrid, please write in detail.
|
August 31st, 2004, 11:20 AM
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
you cant assign a ToolTip to a column of the grid,you should work only with DataGridItem objects,
work with DataGridItems of a specific column and assign them a joint value ...
--------------------------------------------
Mehdi.:)
|
September 18th, 2004, 04:15 AM
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
something like below
Code:
private void BindGrid()
{
//...
DataGrid1.DataSource=ds//a simple DataSet
DataGrid1.DataBind();
//...
foreach(DataGridItem dgItem in DataGrid1.Items)
{
dgItem.Cells[0].ToolTip="Column0";
dgItem.Cells[1].ToolTip="Column1";
dgItem.Cells[2].ToolTip="Column2";
//....other cells like above
}
}
--------------------------------------------
Mehdi.:)
|
September 20th, 2004, 12:17 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
|
|
The appropriate place to put this code is in the ItemDatabound event of the grid. It will fire for each row of the grid. You dont need to iterate through the items in the grid.
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
e.Item.Cells[0].ToolTip = "Column0";
e.Item.Cells[1].ToolTip = "Column1";
e.Item.Cells[2].ToolTip = "Column2";
//....other cells like above
}
Ganesh
|
September 20th, 2004, 08:37 AM
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hello Ganesh,
yes great place ,but consider a grid including rows arent going to be bound ....
just in that situation we have to iterate through the items in the grid,
Cheers.
--------------------------------------------
Mehdi.:)
|
September 21st, 2004, 01:53 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You are right Mehdi.. Can you give me an example in which a datagrid is used without databinding.
Ganesh
|
September 21st, 2004, 08:37 AM
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
I didnt mean a DataGrid object,I dont think a DataGrid(or DataList or Repeater) could work correctly without databinding!!!?...
I meant something like Table objects without any databinding
--------------------------------------------
Mehdi.:)
|
September 23rd, 2004, 01:39 AM
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
|
|
But the question was regarding a datagrid...
Ganesh
|
|
|