Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old July 28th, 2008, 12:20 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

Can you post your whole gridview code? i'm a little unclear of exactly what you have now.

Jason Hall
Reply With Quote
  #12 (permalink)  
Old July 28th, 2008, 12:36 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

GridView code:

Code:
<asp:GridView ID="GridView2" runat="server" Style="z-index: 10px; position: relative; top: 43px; border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; font-size: 12px; left: 10px;" Width="518px" AllowPaging="True" AllowSorting="True" Font-Size="Small" AutoGenerateColumns="False" CellSpacing="2" 
            HorizontalAlign="Left" BorderColor="LightGray" BorderStyle="None" PageSize="14" OnSorting="GridView2_Sorting" EmptyDataText="N/A">
               <Columns>
                   <asp:BoundField DataField="job_date" DataFormatString="{0:d}" HeaderText="Date" SortExpression="job_date" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Center" Width="40px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_number" HeaderText="Cost Code" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Left" Width="60px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_status" HeaderText="Active (Y/N)" SortExpression="item_status" >
                       <ItemStyle HorizontalAlign="Center" Width="25px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_qty" HeaderText="Quantity">
                       <ItemStyle HorizontalAlign="Right" Width="55px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_uom" HeaderText="UOM">
                       <ItemStyle HorizontalAlign="Center" Width="15px" />
                   </asp:BoundField>
                   <asp:ButtonField CommandName="notes" DataTextField="item_notes" HeaderText="Notes"
                       Text="notes" />
                   <asp:TemplateField HeaderText="Notes1" Visible="False">
                       <EditItemTemplate>
                           <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("item_notes1") %>'></asp:TextBox>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Bind("item_notes1") %>'></asp:Label>
                       </ItemTemplate>
                   </asp:TemplateField>
            </Columns>
                <HeaderStyle BackColor="#FFC080" Height="35px" />
                <AlternatingRowStyle BackColor="#FFFFC0" /> 
                <RowStyle Height="20px" />
                <SelectedRowStyle BackColor="#FF8080" />

            </asp:GridView>


Reply With Quote
  #13 (permalink)  
Old July 28th, 2008, 12:46 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

which field do you want the tooltip to be in?

Jason Hall
Reply With Quote
  #14 (permalink)  
Old July 28th, 2008, 01:18 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

When I click or mouse over item_notes (ie short text) then display long text (item_notes1), so I guess the tool tip will be in:

</asp:BoundField>
<asp:ButtonField CommandName="notes" DataTextField="item_notes" HeaderText="Notes"
 Text="notes" />


Reply With Quote
  #15 (permalink)  
Old July 28th, 2008, 01:26 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

ok make that bound field a template field and set it as a label. then set the label's ToolTip='<%# Eval("item_notes1") %>'

Jason Hall
Reply With Quote
  #16 (permalink)  
Old July 28th, 2008, 02:39 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Jason, I changed the BoundField to TemplateField and inserted the "ToolTip" segment. Now when I do "mouse-over" no tool tip executes? I must be doing something wrong (as normal):


Code:
<asp:TemplateField HeaderText="Notes">
<EditItemTemplate>
asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("item_notes") %>'>
</asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("item_notes") %>'>ToolTip='<%# Eval("item_notes1") %>'
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
Reply With Quote
  #17 (permalink)  
Old July 28th, 2008, 03:05 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

Try it with bind and not Eval

<asp:Label ID="Label2" runat="server" Text='<%# Bind("item_notes") %>' ToolTip='<%# Bind("item_notes1") %>'
</asp:Label>


Jason Hall
Reply With Quote
  #18 (permalink)  
Old July 28th, 2008, 03:41 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Jason,

With the "bind" I get ASP .Net runtime error: A call to bind must be assigned to a property of a control inside a template.

Not sure what this means.

Reply With Quote
  #19 (permalink)  
Old July 28th, 2008, 03:45 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

The text of the control shows fine correct?

Jason Hall
Reply With Quote
  #20 (permalink)  
Old July 28th, 2008, 03:59 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Jason, yes the grid displays the the short note (item_notes) fine. I tested the hidden values for the long notes and it is there as well.
When I do the "mouse over" nothing happens.

Should I try go back and make it a linkbutton again and convert that to a template field. Just a thought, is there something that I need to do in the PageLoad event?

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Resolved] GridView to Excel snufse ASP.NET 2.0 Basics 2 October 28th, 2008 02:37 PM
[Resolved] GridView Sorting and Paging snufse ASP.NET 2.0 Basics 1 October 9th, 2008 07:45 AM
Can not Edit gridview having TemplateField coolcoder2007 .NET Framework 2.0 4 March 6th, 2008 06:36 AM
[Resolved] IListSource problem in GridView snufse ASP.NET 2.0 Basics 5 February 12th, 2008 01:42 PM
Enable Editing on Gridview - RESOLVED Andrew.Berry ASP.NET 2.0 Basics 0 October 3rd, 2007 05:29 AM



All times are GMT -4. The time now is 10:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.