.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Gridview tooltip and sort expression

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

I am having trouble getting my column header to sort the column after adding a headertemplate that allows the column header to show a tooltip.

Here is the code:

<asp:TemplateField HeaderText="MiddleName" SortExpression="MiddleName">
                    <asp:Label ID="Label201" runat="server" ToolTip="Middle Name" Text="Middle Name"></asp:Label>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("MiddleName") %>'></asp:Label>

View Complete Post

More Related Resource Links

Displaying Row Details Tooltip on GridView using JQuery

Continuing exploring JQuery! I decided to implement a feature to display some kind of details related to a row displayed on GridView. For example when displaying employees details on GridView some information might not fit in the GridView because it will make it huge and wide. These infomration can be diplayed as Tooltip. Or when you want to display a picture and some kind of formated text to be diplayed as tooltip when mouse hover on the image.

How To Open Fancy Tooltip from GridView

This article will show How To Open show Fancy Tooltip in GridView.

Create ToolTip for GridView Header

The following allows you to add a tooltip to the header links of your GridView, a feature that is lacking.

Tooltip for GridView Column Headers (ASP.Net)

I just wanted to add auto tooltips for my GridView headers. There are couple of ways but I don't want to use javascript and wanted to use simple 'title' attribute. It took couple of hours to get the working code supporting sortable columns. I thought it will be very useful for others. Here's the code and logic behind it.

How to sort GridView?

In this article I will discuss how to sort columns in grid and more. At the end it will help answer some very frequently asked questions like following

Sort by gridview SortExpression parameter via Stored Procedure


I have a gridview that calls data via a stored procedure.  I am unable to enable the gridview columns to be sortable. I need to set the parameter in the Stored Procedure, can someone help me with this?

Here is my gridview:

<asp:GridView ID="AllUsersGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName"
                        GridLines="Vertical" Width="900px" DataSourceID="SqlDataSource1" AllowSorting="True"
                        SelectedRowStyle-Height="30px" CellPadding="4" BackColor="White">
                            <asp:TemplateField HeaderText="Full Name" SortExpression="lastname">
                                    <asp:Label ID="DisplayName" runat="server" Text='<%# Eval("firstname").ToString() & " " & Eval("lastname").ToString() %>' />
                            <asp:BoundField HeaderText="User Name" DataField="UserName" />

AllItems.apsx sort by expression missing

Hello, I am using SPD and would like to add a sort expression to my default view to sort a list - why is this feature not available and is there any way to do this? Thanks... 

Custom Headers in Gridview, need to be able to sort

I have a Custom Header that I need to beable to sort.  The headers consist of a Textbox (for entering a search value) and a Linkbutton to fire the event.  I just need to know how to point that button to the sort function of the gridview. Thank you for the help,

Is it possible to assign a tooltip to the rows of a GridView in a ListView?

On my VS 2010 WPF app, I've got a GridView within a ListView.  The user searches for some clients, and the clients that match the search are put into the list view.  I'm wondering if it is possible to bring up data that would be specific the the client that the user is hovering the mouse over, in a tooltip?  And if the answer is yes, how is that done?Rod

How to sort # column in GridView (asp.net) ?


I have a GridView with a column that contains rows numbers. somethign like below :

1    |
2    |
3    |
.     |
.     |
.     |
11  |
12  |
13  |
.    |
.    |
.    |

I've added it to the GridView with the following code :

<asp:TemplateField HeaderText="#" SortExpression="#">
<%# Container.DataItemIndex + 1 %>

Now I wanna sort GridView with this column, I've done it by reading this thread. But when I sort the GridView by # column, it sorts the GridView like below :

1   |
11 |
12 |
.   |
.   |
.   |
21 |
22 |
23 |
.   |
.   |
.   |

How can I fix it

Sort Gridview with jquery


hi to all plz tell me,

how to sort gridview using jquery???

thanks in advance

Gridview does not sort on gvClaimDetails_Sorting

i have placed the code inside and found out that it does not sort after clicking the clickable header column in gridview.

  <asp:BoundField HeaderText="Date" DataField="datecreatedname" SortExpression="datecreatedname"
                                    <HeaderStyle  ForeColor="White"></HeaderStyle>


protected void gvClaimDetails_Sorting(object sender, GridViewSortEventArgs e)
        DataTable m_DataTable = gvClaimDetails.DataSource as DataTable;

        if (m_DataTable != null)
            DataView m_DataView = new DataView(m_DataTable);
            m_DataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql2(e.SortDirection);

            gvClaimDetails.DataSource = m_DataView;



    private string ConvertSortDirectionToSql2(SortDirection sortDirection)

Dynamic Data Field template edits - Tooltip text, Dynamic Data Page template edits - field sort


I have an ASP.net website build in VB 2010 web dev pro using 4.0 framework.  Its a dynamic data site and I am having some trouble formating some of the field and page canned templates.

Q1: Field Templates - the tooltip code (TextBox1.ToolTip = Column.Description) is within the ascx.vp pages for each of the field templates.  Where can I update each columns description (as the code references) so the tooptip will be column/field specific.  If its not as straight forward as that, I was trying to write an if/else statement because the tooltip code is set at the field type level (decimal, date, etc) and I want it to be column specific.  example;

if column.value = Financial Impact

then  TextBox1.ToolTip = "enter financial impact in whole dollars"

else TextBox1.ToolTip = "next fields tooltip text"



WPF: how to make a GridView only sort on one column as ascending order?


We use GridView inside the Listview. We need the grid view alwasy sort on one column ascending order and not allow to click column header to change it.

Is there a easy way to achieve it in Xaml?

If not possible, how to achieve it in code behind?



gridview sort on changed cell text


I have a gridview that is being databound by an SQLdatasource and on  RowDataBound i am doing a calculation and then setting


e.Row.cells(17).text = Result


However, when I go to sort it on the website it sorts it based off the previous values.


Cell(17) from the datasource reads in all 1's. The numbers I change it to range from 0 to 15. So when I click sort nothing changes because it sees it as all 1's.

How can i make the gridivew sort off the changed text values?

Why when I click on title header to sort a GridView, some data disappear?


 Hi there

When I click on my GridView header "End Time" all the rows which contain the string "N/A" disappear.
Here is my code:

protected void GridView2_Sorting(object sender, GridViewSortEventArgs e)
FillDataGridView_JobHistory(ViewState["DateBegin"].ToString(), ViewState["DateEnd"].ToString());

Note: GetSortDirection returns "endTime ASC" or "endTime DESC" and save in ViewState:

ViewState["SortDirection_JobHistory"] = sortDirection;
ViewState["SortExpression_JobHistory"] = column;

Then I fill the DataAdapter and use the ViewState info to sort it:

protected void FillDataGridView_JobHistory(string dateBegin, string dateEnd)
string query = "dbo.GetJobHistory";
DataTable dt = new DataTable();
SqlConnection myConnection = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);

SqlCommand cmd = new SqlCommand(query, myConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@dateBegin", SqlDbType.DateTime));
cmd.Parameters.Add(new SqlParameter("@dateEnd", SqlDbTyp

Use jQuery to paging and sort asp.net GridView at client side



   I would like to know if there were any Plugin of jQuery to do both paging and sort for Asp.net Gridview control at client side?

    Thank you,



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend