Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
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
 
Old August 30th, 2004, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old August 30th, 2004, 02:01 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.:)
 
Old August 31st, 2004, 06:51 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can the property with datagrid but how to set with a particular column of the datagrid, please write in detail.

 
Old August 31st, 2004, 11:20 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.:)
 
Old September 18th, 2004, 04:15 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.:)
 
Old September 20th, 2004, 12:17 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

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

 
Old September 20th, 2004, 08:37 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.:)
 
Old September 21st, 2004, 01:53 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You are right Mehdi.. Can you give me an example in which a datagrid is used without databinding.


Ganesh

 
Old September 21st, 2004, 08:37 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.:)
 
Old September 23rd, 2004, 01:39 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

But the question was regarding a datagrid...

Ganesh






Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse Tooltip in ASP pendemv Classic ASP Components 4 November 21st, 2008 05:21 PM
How to create a tooltip Neha XSLT 2 July 14th, 2008 06:21 AM
tooltip interval??? nerssi HTML Code Clinic 5 August 4th, 2006 12:05 AM
tooltip Lucian Ion Javascript How-To 1 August 1st, 2005 10:52 AM
breacking message in a ToolTip chipset Pro VB 6 1 April 12th, 2005 07:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.