Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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 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 July 28th, 2008, 12:20 PM
Friend of Wrox
 
Join Date: Nov 2007
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
 
Old July 28th, 2008, 12:36 PM
Friend of Wrox
 
Join Date: Mar 2007
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>


 
Old July 28th, 2008, 12:46 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

which field do you want the tooltip to be in?

Jason Hall
 
Old July 28th, 2008, 01:18 PM
Friend of Wrox
 
Join Date: Mar 2007
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" />


 
Old July 28th, 2008, 01:26 PM
Friend of Wrox
 
Join Date: Nov 2007
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
 
Old July 28th, 2008, 02:39 PM
Friend of Wrox
 
Join Date: Mar 2007
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>
 
Old July 28th, 2008, 03:05 PM
Friend of Wrox
 
Join Date: Nov 2007
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
 
Old July 28th, 2008, 03:41 PM
Friend of Wrox
 
Join Date: Mar 2007
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.

 
Old July 28th, 2008, 03:45 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

The text of the control shows fine correct?

Jason Hall
 
Old July 28th, 2008, 03:59 PM
Friend of Wrox
 
Join Date: Mar 2007
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?






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





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