Extended GridView Control
 
Published: 10 Aug 2006
Unedited - Community Contributed
Abstract
In this article Bilal Haidar explains in detail an extended GridView control developed based on the GridView control that ships with ASP.NET 2.0. Also discussed are important features of this new GridView: the built-in context menu row-based and the Filter textbox to filter the GridView's rows.
by Bilal Haidar
Feedback
Average Rating: 
Views (Total / Last 10 Days): 317138/ 372

Introduction

This article focuses on explaining a set of features that have been added to the GridView controls that ship with ASP.NET 2.0.  Two main features among the list are the ContextMenu row-based and Filter Textbox to filter GridView’s rows.  During the last few weeks we have been working on extending the new GridView controls that ship with ASP.NET 2.0.

There are several production controls that offer the features that we have added to the GridView control.  However, none of those controls based their work on the GridView control.  As you have probably seen, those controls were always rebuilt from scratch.

Extending the current GridView control gives you more control over the GridView since nothing will be changed in the way you have been using the GridView control.  Rather, you will be able to add and use additional features that are needed from time to time.

We were able to add several new features, among which are:

1.      Single Row Click

2.      Double Row Click

3.      ContextMenu row-based

4.      Ascending/Descending sorting image in the Header elements

5.      Fix GridView height when the number of rows < the page size

6.      Built-in Filter Textbox

7.      Built-in Checkbox per row and per whole GridView

In addition we have created three simple buttons that can be enabled to have a confirmation client-side message or to function normally.

·         Confirm Button

·         Confirm Image Button

·         Confirm Link Button

The Basics

The extended GridView control inherits and this extends the GridView control that is part of the new set of controls that ship with ASP.NET 2.0.

The following code listing shows the header of the extended GridView control.

Listing 1

namespace CustomControls
{
    namespace Grid
    {
        [ToolboxData("<{0}:xGrid runat=server></{0}:xGrid>")]
        public partial class xGrid : GridView
        {

To use this control, simply drag it from the Visual Studio 2005 Toolbox after you have added it to the Toolbox.  Adding it to the Visual Studio 2005 Toolbox is not in the scope of this article.

A simple usage of the extended GridView control is as follows:

Listing 2

<xGrid:xGrid ID="XGrid1" runat="server"  AutoGenerateColumns="False" />
Single Row Click

This is the first new feature added to the GridView control.  You are now able, with just a single mouse click on a row, to post back and process a request.  You might think of implementing a master/detail using this single row click feature.  A new RowClick event has been added to the GridView that you can implement to process the single row click.

Related properties to this feature are:

·         EnableRowClick: This property can be either true or false.  By default it is false.

·         MouseOverColor: This property specifies the mouse over color on a row when the EnableRowClick is set to true.  It is shared between Single Row Click and Double Row Click features.

Figure 1 shows a row clicked (then selected) and a simple line stating which row was clicked.

Figure 1

 

You can handle the RowClick event and include any code to process when a single row click occurs.

Listing 3

protected void XGrid1_RowClick(object sender, RowClickEventArgs e)
{
  Response.Write("You clicked row: " + e.GridViewRow.RowIndex);
}

The RowClickEventArgs extends the default EventArgs class and adds a new property called GridViewRow that gives you full access to the row that has been clicked.

Double Row Click

This is the second new feature added to the GridView control.  You are now able, with just a double mouse click on a row, to post back and process a request.  You might think of putting the current row double clicked in Edit mode as a simple usage of this feature.  A new RowDoubleClick event has been added to the GridView that you can implement to process the double row click.

Related properties to this feature are:

·         EnableRowDoubleClick: This property can be either true or false; by default it is false.

·         MouseOverColor: This property specifies the mouse over color on a row when the EnableRowDoubleClick is set to true.  It is shared between Single Row Click and Double Row Click features.

Figure 2 shows a row double clicked (then selected) and a simple line stating which row was double clicked.

Figure 2

 

You can handle the RowDoubleClick event and include any code to process when a double row click occurs.

Listing 4

protected void XGrid1_RowDoubleClick(object sender, RowDoubleClickEventArgs e)
{
  Response.Write("You double clicked row: " + e.GridViewRow.RowIndex);
}

The RowDoubleClickEventArgs extends the default EventArgs class and adds a new property called GridViewRow that gives you full access to the row that has been double clicked.

ContextMenu row-based

During our research that spread over a month and a half, we could not find any GridView ContextMenu enabled!  This is the first built-in enabled GridView ContextMenu!

We have used the context menu developed by Dino Esposito that was published in the MSDN magazine.  A link to that article is listed below in the resource section.

That context menu was developed mainly for ASP.NET 1.1.  We have created a new project in ASP.NET 2.0 and copied the same code with some changes.  In one change OnClickClick property has been added to each context menu item so that developers can attach some client side code that runs before posting back to the server.

The client side code, mainly the JavaScript used by the context menu, is now included as a resource according to the techniques used in ASP.NET 2.0.

The context menu is now an ASP.NET 2.0 project.  It has been integrated within each row in the extended GridView control, so that when you right click on a row, you will be able to have access to the right-clicked row.  The extended GridView control now has a new property called RightClickRow that returns the current row that has been right-clicked to show the context menu.

Related properties to this feature are:

·         ContextMenuID: The GridView is context menu enabled when this property is set to the ID of a context menu placed on the ASPX page.

·         RightClickedRow: This property returns the GridViewRow where the right click was applied to show the context menu.  Any option you choose from the context menu will be applied on the current row where you have applied a mouse right click.

Figure 3 shows a context menu when a mouse right click was applied on a row.

Figure 3

 

The context menu popped up when a mouse right click was applied on the row.  The current context menu shows 3 different options.

Add a new Row: When clicked, a new entry row will be shown in the footer of the GridView control.  This is shown in Figure 4.

Delete Row: Allows you to delete the current right-clicked row.

Edit Row: Allows you to set the current right-clicked row in the edit mode.

Figure 4 that shows the GridView control in Insert mode when the “Add a new Row” option from the context menu was chosen.

Figure 4

Notice that the Context menu can be bound in several ways.

·         You can manually add new ContextMenuItem objects through the ContextMenuItems property of the context menu.

·         You can gather data from a database, loop through them and finally add them to the ContextMenuItems property of the context menu.

·         Also, you can load an XML file.

The following are the steps required to enable Context Menu on the GridView control.

·         Add an instance of the ContextMenu control on the ASP.NET page.

·         Add an event handler for the items clicked inside the ContextMenu.

·         Load ContextMenu with ContextMenuItems.

Configure the GridView control’s ContextMenuID with the ID of the context menu added.

You can start as follows:

Listing 5

<ctMenu:ContextMenu ID="ContextMenu1"
 runat="server" BackColor="#99CCCC"
 ForeColor="Maroon" OnItemCommand="ContextMenu1_ItemCommand"
 RolloverColor="#009999" />

The above code listing shows a ContextMenu having an ID of ContextMenu1 and a handler for the menu items which is the OnItemCommand.  This handler will be fired once the user chooses an option from the ContextMenu.

The event handler can be something like the following.

Listing 6

protected void ContextMenu1_ItemCommand(object sender, CommandEventArgs e)
{
  // Use the RightClickedRow property which is a GridViewRow to know
  // which row was right-clicked
  int rowIndex = this.XGrid1.RightClickedRow.RowIndex;
 
  switch (e.CommandName)
  {
    case "Add":
      this.XGrid1.ChangeInsertMode(true);
      break;
    case "Edit":
      this.XGrid1.EditIndex = rowIndex;
      break;
    case "Delete":
      DeleteGridViewRow(rowIndex);
      break;
    default:
      break;
  }
}

In case the user chooses “Add a new Row,” then we are setting the GridView in an insert mode using the built-in new method, ChangeInsertMode.  This flips the GridView between Insert and normal modes.  To be able to allow the GridView to insert new rows, you need to set up the form controls used to gather data from users in the FooterTemplate of each Row.

In case the user chooses “Edit Row,” we are setting the GridView’s EditIndex so that the currently right-clicked row is in now edit mode.

When the user chooses “Delete Row,” we are calling a method that handles deleting from the GridView.

As aforementioned, we need to set the ContextMenuID property of the GridView to “ContextMenu1” in order to enable ContextMenu on the GridView.  A sample GridView is shown below.

Listing 7

        <xGrid:xGrid ID="XGrid1"
 runat="server" AllowPaging="True"
 AutoGenerateColumns="False" DataKeyNames="CustomerID"
 ContextMenuID="ContextMenu1">
            <Columns>
                <asp:TemplateField HeaderText="Manage Row">
                    <edititemtemplate>
                        <asp:LinkButton
 text="Update" runat="server" id="lnkUpdate"
 CommandName="Update" CommandArgument='<%
 Bind("CustomerID") %>' />&nbsp;&nbsp;
                        <asp:LinkButton
 text="Cancel" runat="server" id="lnkCancel"
 CommandName="Cancel" />
                    
</edititemtemplate>
                    <footertemplate>
                        <confirmControl:ConfirmLinkButton ID="lnkAdd" runat="server"
 Text="Add" MessageText="Are you sure you want to add this
 record?" OnClick="btnAdd_Click" />
                        <asp:LinkButton
 id="lnkCancelAdd" runat="server" text="Cancel"
 OnClick="btnCancel_Click" />
                    
</footertemplate>
                    <itemtemplate>
                        <asp:LinkButton
 id="lnkEdit" runat="server" CommandArgument='<%
 Bind("CustomerID") %>' CommandName="Edit"
 text="Edit" __designer:wfdid="w1"></asp:LinkButton>&nbsp;&nbsp;
 <confirmControl:ConfirmLinkButton id="lnkDelete"
 runat="server" CommandArgument='<% Bind("CustomerID")
 %>' CommandName="Delete" MessageText="Are you sure you want
 to delete this record?" Text="Delete"></confirmControl:ConfirmLinkButton> 
                    
</itemtemplate>
                </asp:TemplateField></Columns>

An example on how to load the ContextMenu from an XML file is shown in the listing below.

Listing 8

private void PopulateContextMenu()
{
  XmlReaderSettings settings = new XmlReaderSettings();
  string contextmenuxml = Path.Combine(Request.PhysicalApplicationPath,
    "contextmenu.xml");
 
  NameTable nameTable = new NameTable();
  object contextMenuItem = nameTable.Add("contextmenuitem");
 
  settings.NameTable = nameTable;
 
  using(XmlReader reader = XmlReader.Create(contextmenuxml, settings))
  {
    while (reader.Read())
    {
      // Read a single ContextMenuItem
      if ((reader.NodeType == XmlNodeType.Element) && (contextMenuItem.Equals
        (reader.LocalName)))
      {
        XmlReader subTree = reader.ReadSubtree();
        ContextMenuItem menuItem = new ContextMenuItem();
 
        // Get contents of a single ContextMenuItem
        while (subTree.Read())
        {
          if ((subTree.NodeType == XmlNodeType.Element) &&
            (subTree.LocalName.Equals("text")))
            menuItem.Text = subTree.ReadString();
 
          if ((subTree.NodeType == XmlNodeType.Element) &&
            (subTree.LocalName.Equals("commandname")))
            menuItem.CommandName = subTree.ReadString();
 
          if ((subTree.NodeType == XmlNodeType.Element) &&
            (subTree.LocalName.Equals("tooltip")))
            menuItem.Tooltip = subTree.ReadString();
 
          if ((subTree.NodeType == XmlNodeType.Element) &&
            (subTree.LocalName.Equals("onclientclick")))
            menuItem.OnClientClick = subTree.ReadString();
        }
 
        // Add item to ContextMenu
        this.ContextMenu1.ContextMenuItems.Add(menuItem);
      }
    }
  }
}

The XML file used is as follows.

Listing 9

<?xml version="1.0" encoding="utf-8" ?>
<contextmenu>
  <contextmenuitem>
    <text>Add a new Row</text>
    <commandname>Add</commandname>
    <tooltip>Add a new Row</tooltip>
    <onclientclick />
  </contextmenuitem>
  <contextmenuitem>
    <text>Delete Row</text>
    <commandname>Delete</commandname>
    <tooltip>Delete Row</tooltip>
    <onclientclick>return
 __ConfirmMessage('Are you sure you want to delete this
 row?');</onclientclick>
  </contextmenuitem>
  <contextmenuitem>
    <text>Edit Row</text>
    <commandname>Edit</commandname>
    <tooltip>Edit Row</tooltip>
    <onclientclick />
  </contextmenuitem>
</contextmenu>

Each ContextMenuItem contains the following fields to set.

·         Text: The text to be displayed in the ContextMenu.

·         CommandName: The name of the command to process, examples are "Edit," "Delete," "Add," or any other command name that you want to handle in the OnItemCommand event handler.

·         Tooltip: A tooltip to show on a ContextMenuItem.

·         OnClientClick: Any valid client side code to run before posting back to the server.

Ascending/Descending sorting image in the Header elements

This feature adds an ascending/descending image beside each element in the GridView header when it is configured for sorting.  When the GridView initially loads no images will be displayed; only when you click on a header element to sort to, a corresponding image is shown reflecting the current sort order.

Figure 5 shows an arrow beside a column that was clicked for sorting.

Figure 5

Related properties to this feature:

AscImage: This property specifies the path to the image used as an ascending image.

DescImage: This property specifies the path to the image used as a descending image.

Fix GridView height when number of rows < page size

Have you ever noticed that when the number of rows displayed in a GridView is less than the page number, the GridView shrinks in height?

Suppose you were in Page 1 of a GridView showing 10 records, then you moved to Page 2 where it displays only 5 records, you will notice that the GridView height shrunk to fit those 5 records.  This can be annoying!   Would not it be better to keep the GridView height the same no matter the number of records being displayed?

In Figure 6 you will see a GridView with only a few records and you will notice empty records are added automatically because the number of records shown is less than the GridView’s page size.

Figure 6

Notice the three empty records added just to maintain the GridView height.

This is a built-in feature so you would find any property in the extended GridView control to configure it.

Built-in Filter Textbox

This is the second most interesting feature after the ContextMenu feature.  You can type any text inside a Textbox added to the GridView control in a custom header above the normal header.

You type in some text and hit the enter key on your keyboard.  An event handler for the FilterCommand is provided for you to handle the filtering the way you want it.  You can base your filtering on the one column data or all columns depending on the logic you provide in the FilterCommand event handler.

Related properties to this feature are:

IsFiltered: This property can be either true or false.  By default it is false.  When set to true, a new custom header will automatically be added to the GridView to allow users to enter text to filter the GridView accordingly.

FilterStyle: This property allows you to specify a style for the newly added custom header.  You configure this property much the same as you would do to the SelectedRowStyle, RowStyle, HeaderStyle, etc.

CSSFilterbox: This property allows you to provide a CSS class for the Textbox used in the custom header.

SkinIDFilterbox: This property allows you to provide a SkinID to the Textbox used in the custom header.

Figure 7 shows a GridView control with a custom header and some text that we have used to filter the GridView’s data.

Figure 7

Notice that paging, filtering, editing, etc. all function normally without requiring any special handling from your side.

You can handle the FilterCommand event and include any code to filter the GridView on.

Listing 10

protected void XGrid1_FilterCommand(object sender, FilterCommandEventArgs e)
{
  if (!e.FilterExpression.Equals(""))
  {
    FilterBind(e.FilterExpression.ToString());
    //return;
  }
 
   // Serves both with/out filter
  this.XGrid1.DataBind();
}

The FilterCommandEventArgs extends the default EventArgs class and adds a new property called FilterExpression that gives you the text that has been typed by the user in the filter Textbox.

Built-in Checkbox per row, and per whole GridView

This feature adds a checkbox to every row in a GridView and a main checkbox in the GridView’s header.  When a checkbox is checked, the whole row is selected.  Moreover, when the checkbox in the GridView’s header is checked, all the rows in the current Page will be selected.

The selection process is done on the client side without a need to post back.

This feature is taken from Dino Esposito’s article in MSDN magazine that extends the GridView to add this single feature.  The same code was used without any changes.

A link to Dino Esposito’s article is given in the resource section at the end of this document.

Related properties to this feature are the following.

AutoGenerateCheckBoxColumn: This property can be either true or false; by default it is false. When set to true, a new Column will be added to the GridView control, including a checkbox used to select a row.

CheckBoxColumnIndex: This property allows you to specify the location of the checkbox column in the GridView control.

Figure 8 shows a GridView control that has the AutoGenerateCheckBoxColumn set to true and the CheckBoxColumnIndex set to 0.

Figure 8

One thing to mention, when either EnableRowClick or EnableRowDoubleClick are enabled, selecting a row will not reflect a complete SelectRowStyle due to the effect of the MouseOverColor.  Once we select a row and the mouse is out, the row’s background will be revert back to the GridView’s original row background color, but the ForeColor will be applied.

Confirm Buttons

We have included three different buttons: Confirm Button, Confirm Image Button and Confirm Link Button.  These are normal buttons with two main properties added to each.

EnableConfirmMsg: This property can either be true or false.  When set to false, the button will be used as a normal button.  When the value is true, a confirmation message will be shown on the client side before posting back to the server.

MessageText: This property specifies the text to be shown when the EnableConfirmMsg is set to true.

Some of these buttons were used in the GridView templates which you can find in the accompanying downloadable code with this article.

Downloads

Resources

To be able to add all the above mentioned features, we had to research the web for a number of articles and blog posts to give us a deeper understanding of the GridView control, to learn how we could manipulate the GridView control and to add some of the features mentioned above.

Here is a list of most of the resources that were researched prior to building this extended GridView.

Adding a Context Menu to ASP.NET Controls

Fredrik Normen’s Blog

Building a Full-Featured Custom DataGrid Control

Ivan Porto Carrero's Blog

David Hayden's Blog

CodeSnip: Confirming Row Deletion in a GridView

Extending the GridView Control

Extending the GridView's Sorting Capabilities

Matt Dotson’s .NET Tips & Tricks

Mads Kristensen’s Blog

Brock Allen’s Blog

Conclusion

We have presented the seven new features added to the extended GridView control.  The main features are the ContextMenu row-based and the Filter Textbox to filter GridView rows.

If there are any comments or problems with the current features please do not hesitate to contact us to solve them.

In addition, if any one is seriously willing to help in improving the current features and add new features, feel free to contact me to share the code with you so that we can work together to improve the GridView control.

You could definitely use this GridView control with an ATLAS UpdatePanel to see how effective it would be to have all those features together with ATLAS.

Big thanks to Scott Guthrie, Polita Paulus, Dino Esposito, Scott Mitchell, Teemu Keiski, and Badri Narayanan and everyone else who helped us deliver this work.

Special thanks to Wessam Zeidan and Alister Jones for their continuous nonstop support.

Hope you enjoyed the new GridView control.

Happy Dot Netting!!



User Comments

Title: Extended Grid View Values to Java script   
Name: Sivakumar
Date: 4/18/2011 2:26:51 AM
Comment:
Hi,
How to get the values from an Extended Grid View values which has Embedded values in it to Java script?
I am having an Grid view in an usercontrol, based on editing a row value the values will be appear in the Extended grid view. Now, how to get those values in Java script?
Title: Gridview dataset binding   
Name: Ankit
Date: 12/30/2010 8:19:11 AM
Comment:
Hello,

How can we bind the gridview to dataset?
In a given demo , if i bind the gridview to dataset then sorting gives me error of "OnSorting" event not found. So i add that event but then sorting stops working.
It works perfectly with sqldatasource
Title: Extented Gridview control   
Name: Rohan Shah
Date: 7/7/2010 7:41:11 AM
Comment:
Hi Bilal,
The article is really informative and useful for my project. Can you tell me where can I get the code for Extented Gridview control implementation.

Thanks,
Rohan
Title: Ajax   
Name: dragosvelica
Date: 4/15/2010 5:56:55 AM
Comment:
Hi,

Great work!
I have an Ajax Script Manager on the page and the Context Menu is not working, can you, please, help me?

Thanks!
Title: Re: Where is download?   
Name: Bilal Haidar
Date: 4/9/2010 3:02:15 PM
Comment:
Hello Adrian,
The code can be found at: http://xgrid.codeplex.com/

Regards
Title: Where is download ?   
Name: Adrian
Date: 1/28/2010 11:15:44 AM
Comment:
The download doesn't have the gridview source code, yet the article implies that it is available. Where is it ?

Thanks!
Title: Row Click and Edit   
Name: Nomo
Date: 10/13/2009 2:06:02 PM
Comment:
With xGrid, it's possible to change a row to edit mode when you select it? How it's done?
Title: Right Click not centred on row   
Name: Steven
Date: 10/6/2009 3:08:51 AM
Comment:
Hi,
I have managed to get your project working in update panel and using master pages, however the right click is appearing a about 200 pixles below the grid view. Any ideas?
Title: Context menu in extended gridview is not working in Firefox   
Name: Sarithap
Date: 9/24/2009 5:15:05 AM
Comment:
This Article is nice but Context Menu is not working in FF how can i fix it?
Title: Can it extend to support fixed header and footer   
Name: Jack Wu
Date: 9/10/2009 12:52:04 PM
Comment:
The is a good object but if it can support fixed header and footer will be better. Thank you very much.
Title: RE: Capturing column index when right click on row   
Name: Xentrix
Date: 4/24/2009 9:20:35 AM
Comment:
Hi i have done this for an application and will be happy to send you my code. For further information my Email is webmaster@gloscol.ac.uk. Please email me for the info
Title: Capturing column index when right click on row   
Name: amp
Date: 4/22/2009 3:15:18 PM
Comment:
Problem: Would like to right click on a column header and a context menu would allow a user to format a column of data (ie, 1 versus 2 decimal places), hide the column or move the column to another position. Since I've found no way in gridview or xgrid to do this, I am settling on using the right click on a row context menu that xGrid supports. However, I need to be able to determine the column index where the user right clicked the row. How can I do this?
Title: Problem with Context Menu   
Name: Nitin K
Date: 3/13/2009 1:56:47 AM
Comment:
Hi,
I need a Context menu which changes for each row.
Pls tell me, how to do this?
Title: GridView Row Generation   
Name: Debi Chandra Sen Gupta
Date: 2/19/2009 12:39:05 AM
Comment:
I have a gridview having two columns whose header part contains of two textboxes. My requirment is when i will enter any value in the textbox & press enter a row will be generated containing two text boxes.please give me the solution.
Title: Re: License   
Name: Bilal Haidar
Date: 1/5/2009 11:43:00 AM
Comment:
It is free :)
Title: About License   
Name: Nikunj
Date: 1/5/2009 6:12:03 AM
Comment:
Hi..Nice Control..

I just want to know about license for this control
Is this a free to use? or have to purchase license
Title: Plzz tell me   
Name: imran
Date: 11/17/2008 9:30:16 AM
Comment:
i hav a proble regarding xgrid,contextmenu
i hav a web control where i need to map the xgrid and context menu but there is no body so it will no show a context menu on right click plzzz help me and give me a solution for using web control...
Title: reply for javascript onMouseOver   
Name: skm
Date: 11/5/2008 12:28:46 PM
Comment:
use cssclass for the xgrid
Title: Context menu as default commands   
Name: Jacob
Date: 11/4/2008 3:47:49 AM
Comment:
Great Job!!!
My question is: how can I add the standard grid view commands (select, edit, delete, cancel, update) to the context menu, so the grid will execute their default behavior, with no need to do it manually?
For instance, add a delete command to the context menu that will behave exactly as a button with a delete command. Without making the delete progromatically.
Title: place a gridview in gridview control   
Name: kamal
Date: 10/24/2008 11:01:46 AM
Comment:
i have a gridview under name field of gridview i have to put one more grid for details about the person is it possible how?
Title: Re: Kwaku Fordjour   
Name: Bilal Haidar
Date: 10/4/2008 4:54:08 PM
Comment:
Watch out when connecting a context-menu with a Grid. make sure the IDs are compatible!

Regards
Title: Multiple Gridviews and one XGrid   
Name: Kwaku Fordjour
Date: 10/4/2008 1:42:29 PM
Comment:
I have two gridviews and one XGrid on a content page. When I right-click on the XGrid context menu, it is directed to the first Gridview control on the page, not next to the context menu associated with the XGrid. Is this a known problem and if so, does anyone has solution for it?
Title: Extended GridView   
Name: Kwaku Fordjour
Date: 9/29/2008 6:20:35 PM
Comment:
I have just come across the extended gridview .dll and appears to be what I have been looking for. Evidently, I am not able to display the contextmenu inside master page. Reading further, there was an indication that a fix has been provided for this. Can you please direct me to the correct project or .dll with the fix. Thanks
Title: RightClickRow   
Name: Branden
Date: 9/4/2008 12:14:37 PM
Comment:
The attribute for the xgrid "RightClickRow" is not an option that I have seen. I have the CustomControls.dll added to the project. I have double clicked the xgrid control onto the content page and it is not there. I have setup the contextmenu control but it shouldn't matter I should be able to enable RightClickRow. What do I need to do?
Title: Latest version?   
Name: Chris
Date: 8/26/2008 4:01:01 AM
Comment:
Brilliant control! Only problem is that when I have two grids on one form with AUTOGENERATECHECKBOX = TRUE and selecting ALL on the one form, then all checkboxes on the second grid is selected as well. Is there a new version of the DLL available? The datestamp on the one I've got is 20 July 2006.
Thanks
Title: Change Height of Control   
Name: khushi2005
Date: 7/24/2008 12:23:10 AM
Comment:
How to control the height of Xgrid when allowPaging=false
I tried to put it under Div tag but it seems that Xgrid inserts 1 more div tag around Xgrid

Is there a way to add scrollbars to grid itself and also keep the header of Gridview fixed

Thanks
Title: Contextmenu   
Name: Rajendira
Date: 6/30/2008 11:03:04 PM
Comment:
How to disable the default contextmenu in the grid 0f vb.net
Title: Missing Object txtSearch   
Name: khushi2005
Date: 6/25/2008 10:49:58 AM
Comment:
I get error on
document.getElementById('txtSearch').focus();
I have downloaded the latest sample
Title: Re: Andy Edwards   
Name: Bilal Haidar
Date: 6/23/2008 2:15:45 AM
Comment:
I never faced this problem before.

Try to download a new copy of the DLL and try again!

Thanks
Title: Re: xgrid into the toolbox   
Name: Andy Edwards
Date: 6/21/2008 5:10:08 AM
Comment:
Hi, I am trying to get the xgrid into the toolbox, I add an item, choose the .dll and an error appears saying the CustomControls.tlb file could not be loaded. Can anyone help??
Title: rowclick and rowdoubleclick not working together   
Name: Shripad Jadhav
Date: 6/16/2008 12:17:11 PM
Comment:
Hi.
Great Job on the whole extension project (very very Impressed).
I read all the comments below and didn't find any fix to have rowClick and rowDoubleClick working together.
Does that mean this is not possible? Cannot they be enabled together? Please give me the possible alternative to this or source code.
thanks
Shriad Jadhav.
Title: Re: xgrid   
Name: Bilal Haidar
Date: 5/12/2008 4:06:03 AM
Comment:
Hello Rachel,
You can easily add the xgrid to the toolbox by adding an item into the Toolbox and selecting the xgrid dll!

Does this help?
Regards
Title: xgrid   
Name: rachel
Date: 5/12/2008 2:04:08 AM
Comment:
hi
can anyone tell me how to use xgrid in asp.net instead of grid view and how to add tht control to the toolbox as well
Title: Does not work inside an updatepanel   
Name: Steven Zheng
Date: 4/3/2008 2:05:32 PM
Comment:
when place inside an update panel, it does a whole page postback. It doesn't do partial postback. Anyone has same problem? Does anyone know a fix? thanks.
Title: Update or updatepanel problem   
Name: Riccardo Mondaini
Date: 3/28/2008 9:43:10 AM
Comment:
I've embedded into update or updatepanel my xgrid. Without this the xgrid works fine, but with the update or updatepanel control, the context menu does not appears.
Do you have any idea or workaround for these issues?

Thank you in advance, best regards, Riccardo
Title: rowclick and rowdoubleclick working together   
Name: Frank
Date: 3/25/2008 10:16:31 PM
Comment:
Hi. Great Job on the whole extension project (very very impressed).
I read all the comments below and didn't find any fix to have rowClick and rowDoubleClick working together.
Does that mean this is not possible? Cannot they be enabled together?
Thanks for your help,

Frank
Title: Header checkbox selects all checkboxes on page   
Name: Raj
Date: 2/26/2008 12:30:00 PM
Comment:
Awesome grid. I am using it in a couple applications. Just noticed that when selecting all rows in the grid by checking the checkbox in the header there is a 'nasty' side effect .. all of the other checkboxes on the page are also selected / deselected.
Title: Filter Text is not working   
Name: Prakash
Date: 2/24/2008 9:51:28 AM
Comment:
Hi Bilal,
I have used your xgrid. The features are nice. But Filter Text box was not working at my end. What I have to do inorder to search the text entered in any column.
Title: __designer:wfdid="w1"   
Name: __designer:wfdid="w1"
Date: 12/24/2007 5:18:32 AM
Comment:
what is this code __designer:wfdid="w1" in asp.net 2.0 with C#

Siva
Title: Drop down list with number of elements per page   
Name: Jozef
Date: 12/8/2007 9:54:24 AM
Comment:
Hello,

this is good idea - just one point - a grdi view should hve a default built in DropDown List with a number of records per page (e.g. 5, 10, 20, 50, 100) - so that the user could choose how many does he/she wants to see. The rest is cool.

Cheers,
Jozef
Title: GridVies Checkbox column   
Name: Dotnet2k5
Date: 12/3/2007 12:28:07 AM
Comment:
Hi All,

I have a requirement in GridView where i need to select only one checkbox index in the gridview. I have given AutoGenerateCheckboxColumn value to true and I get more than one values in the Grid. Now, the user has to select only one checkbox in the grid.. How to restrict the user to select only one checkbox in the GridView?

Thanx in Advance!
Title: gridview footer total by using javascript   
Name: ramesh
Date: 11/23/2007 2:38:42 AM
Comment:
gridview footer total by using javascript
Title: gridview   
Name: gridview
Date: 10/27/2007 3:04:40 AM
Comment:
no
Title: AJAX , Masterpage   
Name: CA
Date: 10/11/2007 5:04:50 AM
Comment:
Hi.

I use a Masterpage with splitter.

1. When I enable filter: Can't move focus to the control ...
Is there a easy way to disable "set focus" ?

2. XGrid and ContexMenu in AJAX updatepanel: When I click Edit,Cancel,doubleclick (Add) etc in xgrid, updatepanel and xgrid works fine , but if I click (Add) in contextmenu the hole page postback.........

3. Maybe in future ?
- Filter, result "no data", resetbutton in EmptyDataTemplate.
- No data in table, new entry row/fields in EmptyDataTemplate.

Thanks in advance.
Title: CUSTOM PAGING - Problem when editing and item.   
Name: Mario E.
Date: 9/24/2007 12:31:00 PM
Comment:
I posted the following message in Codeplex but maybe someone can help me in here. Anyway thanks in advance for any help:

Hi,

I was wondering if you could help me to implement custom paging in XGrid? See, I was trying to implement the information that I found in this article into Xgrid: http://www.codeproject.com/useritems/GridViewNeatPaging.asp but I'm having some problems. Let me be more specific. The paging works fine but when I try to edit one of the items in my gridview then the pageindex gets reseted and the wrong item gets updated. I've tried to keep the pageindex in the ViewState but it I lose it at some point.
Anyway, thanks so much for your help and for sharing such a great project.

Thanks,

Mario.
Title: Invisible Column still show in grid   
Name: Liu
Date: 9/19/2007 4:40:19 AM
Comment:
I forget mention that this bug when "Fix GridView height when number of rows "
Title: Invisible Column still show in grid   
Name: Liu
Date: 9/19/2007 4:37:54 AM
Comment:
When I make a column Visible=False, The GridView still show this column, Is it a bug??
Title: The download Link   
Name: Brendan
Date: 9/5/2007 3:33:41 PM
Comment:
Adam,
The download link is on the download page for the article. If you click on the "downloads" link on the top of the page you will see the link to download the sample.
Title: How can I get the control?   
Name: Adam
Date: 9/5/2007 1:14:31 PM
Comment:
I don't see a link for download
Title: CheckBoxes   
Name: Caas
Date: 8/14/2007 11:39:09 AM
Comment:
I'm triying to use the gridX.GetSelectedIndices and it's returning the lenght = 0, and of course there's some items selecteds, why is this happening? does anybody else have ran with the same issue?, thanks.
Title: Edit filtered row from context menu   
Name: Ernesto Del Villar
Date: 8/13/2007 12:58:20 PM
Comment:
Hello,
I've definiteley found filter functionality to be very useful. However, when I try to edit a filtered row using context menu Edit option, the grid goes back to the unfiltered view and the wrong row becomes editable. This behavior can be checked against the sample code that downloads from this site. Edit button placed in every row works fine even when the grid is filtered.

Thanks Bilal for your kind help.
Title: Source Code   
Name: Jaco
Date: 8/9/2007 8:33:13 AM
Comment:
Is there anyway that I can get the source code for this control? It looks like a brilliant control and I would definitely like to use it.
Title: Gr8 job   
Name: Gaurav Zambare
Date: 8/1/2007 12:47:51 AM
Comment:
Hi Bilal,
Really greatttttttttt Job.
thanks.
But i have one problem.Actually i am very new to asp.net.
I added new tab in toolbox then i added your dll in new tab.But when i add your control after that its not possible for me to run any application thro' VS 2005.
Its giving error "Not found VS localhost web server".
I am sure i am doing something wrong please help me.

Thanks in advance.
Title: Extended Gridview   
Name: GailsHusband
Date: 6/12/2007 1:31:21 PM
Comment:
This looks very interesting and will help improve a project I am working on. I will let you know how it works. I also would like to thank you for all the work you did on this.
Title: about the yxz_RowClick event...   
Name: Marco
Date: 5/24/2007 8:30:07 AM
Comment:
Hi,

I try to figure out how to access my data on the RowClick event... my e.GridViewRow.DataItem is alway null. I need help...
Title: context menu   
Name: ney
Date: 4/23/2007 11:35:11 AM
Comment:
I used you control and followed the steps you have given in your article. That is, context menu on right click of a row. My problem is that my dataset is large, so when i click on a row below, the context menu appears above, and not at the row right clicked. This makes the user have to scrol up to find it. Is there any solution to this?
thanks,
ney
Title: Problem while editing-updating fields   
Name: Gojko Bozic
Date: 3/29/2007 11:12:57 AM
Comment:
Hi,
Great job. Thank you for sharing grid. My problem is:

Clicking on edit I only get row number and if I try to jump
in some field I am getting again row number and son on ...
How to set focus in desired field, edit it and update ?
Regards,
Gojko
Title: Using Sorting / Paging Features W/O Using DataSourceID   
Name: Shawn
Date: 3/20/2007 9:17:34 AM
Comment:
My current application is using a DataPoint from a SharePoint (WSS3.0) DB and then binding it to the underlying DataSource. Unfortunately, when you do that, you need to handle the Sorting/Paging events. While the demo works very well, I seem to lose that functionality in my current implementation by not using the DataSourceID property of the dataview. Can you inform me of a work around?

Thanks.
Title: Access is denied   
Name: Shawn
Date: 3/13/2007 1:42:23 PM
Comment:
I added the CustomControls.dll as a reference and then successfully added the controls to the ToolBox. However, upon dragging it onto the form, I get the following error: "Access is denied." and then "Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))". I got this using both the .DLLs within the sample and the website specified within this thread.
Title: Tiny little cosmetic error   
Name: Stancho Stanchev
Date: 3/9/2007 2:31:36 AM
Comment:
Hi Bilal,

First of all i would like to thank you for the magnificent piece of work you delivered. It's meeting almost all the requirements i have for my project.

The tiny little error first and a question later :D

On the properties tab in visual studio the description for the EnableRowClick and EnableRowDoubleClick are the same. The descrition for EnableRowClick says .... enable Double Click event .... It's located on line 373 of xGrid.cs.

The question i had: Is it possible to user buttons outside the gridview to perform the insert,edit,delete,update and cancel? So far i have managed to hack my through some of then, but i can't figure a way out to expose the functionality of the update and cancel in the insert state.

But once again thanks a lot!
Regards,
Stancho
Title: MouseOverColor and ContextMenues   
Name: Claus
Date: 3/1/2007 4:20:11 AM
Comment:
Hi Bilal,

Great control You have made - solves a lot of issues for me :-)

I have one small problem though. I am using the MoiuseOveColor and ContextMenues in the grid. But when entering the contextmenu - the color of the selected row changes back to normal - which is a bit confusing for my users - their not sure what they have selected. Is there a way to keep the color change while inside the contextmenu or somehow have the row selected on right click too??

Regards
Claus
Title: Re: Christopher   
Name: Bilal Haidar [MVP]
Date: 2/25/2007 3:20:29 AM
Comment:
Thanks Christopher for the script!!

Can you please email them to me @ bhaidar at gmail.com ? I would like to embed them into the GridView control directly!

Thanks again for your help and support!
Regards
Title: Fix for Context Menu right click in Firefox   
Name: Christopher Schick
Date: 2/24/2007 5:47:44 PM
Comment:
I'm sure other's are wishing the context menu from Dino Esposito would work in Firefox as I did. So after playing around with it today and borrowing scripts elsewhere from the web here you go!

// change private const string AttachContextMenu = "return __showContextMenu({0});";
// to private const string AttachContextMenu = "return __showContextMenu({0}, event);";

// then add the event argument to the __showContextMenu function definition

// the rest takes care of Firefox


function __showContextMenu(menu, event)
{
var browserName = whichBrs();

var menuOffset = 2;
if (browserName == "Internet Explorer") {
menu.style.left = window.event.x - menuOffset;
menu.style.top = window.event.y - menuOffset;
menu.style.display = "";
window.event.cancelBubble = true;

}

if (browserName == "Firefox") {
var btn = whichButton(event);
if (btn == 2)
{
menu.style.left = event.clientX - menuOffset;
menu.style.top = event.clientY - menuOffset;
menu.style.display = "";
event.cancelBubble = true;
}
}
return false;
}

function whichButton(e)
{
// Handle different event models
var e = e || window.event;
var btnCode;

if ('object' == typeof e){
btnCode = e.button;
return btnCode;
}
}

function __trapESC(menu)
{
var brwsr = whichBrs();
if (brwsr == "Internet Explorer")
{
var key = window.event.keyCode;
if (key == 27)
{
menu.style.display = 'none';
}
}
}

function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("n
Title: CheckAll checks really does checks all . - Part2   
Name: salman
Date: 2/5/2007 6:10:26 AM
Comment:
I give up.I just could not paste the javascript code
i tried more than half a dozen times. I just must give up.
salman.mohammed@sps.net.sa
Title: CheckAll checks really does checks all . - Part1   
Name: salman
Date: 2/5/2007 5:34:38 AM
Comment:
1. The problem is with the javascript code to check the checkboxes (say that really fast 4 time) for xgrid.
It searches all the controls on the form for Checkboxes
and is supposed to check it if only they have a prefix of Xgrid1 (or whatever ID you used for your Xgrid).

This is where the problem is…
function __CheckAll(me)
{
var index = me.name.indexOf('_');
var prefix = me.name.substr(0,index);
//… the rest of the code is in GridView.js

2. This is the solution. Warning my coding skill is bad. if don’t like the fix . Fix it for me.


/*

me = XGrid1_Header

o could be
XGrid1_ctl01_CheckBoxButton
XGrid1_ctl02_CheckBoxButton
Xgrid1_ctl03_ctl00 – another checkbox

OR
me = Panel1_XGrid1_Header

o could be
Panel1_XGrid1_ctl01_CheckBoxButton
Panel1_XGrid1_ctl02_CheckBoxButton
Panel1_Xgrid1_ctl03_ctl00 – another checkbox

Required : prefix = XGrid1.
OR
prefix = Panel1_XGrid1.
OR
prefix = FormView04_Panel01_XGrid1.

object o should be a checkbox.

object o should be from our AutoGeneratedCheckboxColumn.
easy… we always append ‘CheckboxButton’ to the ID of our
Auto-Generated Checkboxes.

*/
Title: the comment box   
Name: Salman
Date: 2/5/2007 5:32:20 AM
Comment:
this comment box does not accept my comments.is it that they should be shorter than 2236 characters. or is pasting code a problem
Title: Improvements for ContextMenu   
Name: Javier Martínez
Date: 1/29/2007 5:50:48 AM
Comment:
Hi,
I've put in Codeplex (Issue Tracker) some improvements for the ContextMenu class. I wait yours comments.
Title: VB in training   
Name: Tom
Date: 1/28/2007 9:28:16 PM
Comment:
Thank you, this control is great. I am having problems with the row select. Say in a grid of 10, I select the 6th item. Page postback and works great, just like I want. Now I click on header to change sort. The highlight remains on 6th item even though that is not the record I had selected. How can you SET the highlighted row in code behind ? I can only see the selectedindex and in my above example is 6.

Anyone ? Again thanx for making this available. Tom
Title: Re: Javier   
Name: Bilal Haidar [MVP]
Date: 1/28/2007 3:44:51 AM
Comment:
Thanks Javier!
I will be updating my code too!!

Regards
Title: Row color problem (II)   
Name: Javier Martínez
Date: 1/28/2007 3:29:37 AM
Comment:
Hi,
I have found the solution for the problem: In the method 'ApplyCheckBoxStyle' of the file 'xGrid.cs' I have changed 'if( cb.Checked )' by 'if (cb.Checked || r.RowIndex == this.SelectedIndex )' (Line 876) and it works fine now.

The problem is due to refresh the row style when the associated checkbox is unchecked but the row is selected.

I hope this help.
Title: Row color problem   
Name: Javier Martínez
Date: 1/27/2007 5:00:22 PM
Comment:
First: Sorry for my english.
Second: The xGrid control is a very, very good job. Thanks for it.
Third: I have a problem with it. I use the 'Enable Row Click' and 'MouseOverColor' and all it's fine. But when I put 'AutogenerateCheckBoxColumn' to 'true' and CheckBoxColunIndex to '0' happens a curious thing: Only the odd colums use the 'MouseOverColor'. The even columns are transparents despite I don't use any style for the alternating Rows. Anyone knows what's happening.
Title: TO ALL   
Name: Bilal Hadiar [MVP]
Date: 1/5/2007 5:16:03 AM
Comment:
Hello colleagues:
If anyone of you have added any update to the Grid code, please let me know about it.

Regards
Title: Using Checkbox   
Name: Salman Mohammed
Date: 1/4/2007 6:49:17 AM
Comment:
This could've saved me a lotta time. so for anyone else like me interested in how to use the checkbox featue in Xgrid.

foreach (int index in XGrid1.GetSelectedIndices())
{
String Datakey = XGrid1.DataKeys[index].Value.ToString();

// do whatever you want with the key now,
// I just print the Selected keys.
Label.Text += Datakey + " ";
}

//GetSelectedIndices: returns The rows for which the checkbox is checked
Title: SelectedIndices ?!!   
Name: Salman Mohammed
Date: 1/4/2007 6:39:42 AM
Comment:
Alphonso,
Andy Sicignano :
a bit late Sorry, but for any one who needs to get the selected row by using the checkbox feature.

You may find GetSelectedIndices() does the job. I guess Bilal RENAMED SelectedIndices to GetSelectedIndices.
Title: Re: Roger   
Name: Bilal Hadiar [MVP]
Date: 12/26/2006 8:52:10 AM
Comment:
Hello Roger:
check this link: http://www.codeplex.com/xgrid

Regards
Title: please anyone give me link to downlaod this control please   
Name: Roger
Date: 12/26/2006 8:30:38 AM
Comment:
Hi please anyone could tell can i downlaod the this AWESOME XGrid from where please tell me urgently. please mail me here daredev at the rate of gmail dot com
Thanks
Title: Can we know the cell index of the row clicked   
Name: Shweta Kulkarni
Date: 12/22/2006 5:29:03 AM
Comment:
You have done an awesome job.......

I wanted to know that whether i can get cell index of the row clicked?
Title: xGrid   
Name: Alphonso
Date: 12/20/2006 4:07:52 PM
Comment:
Good luck with that Bilal.
My opinion is that you did take the right turn by extending GridView instead of creating a new control.
Cheers.
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 12/20/2006 2:26:52 PM
Comment:
Hello:
I am currently trying to find some time to refactor the code, update it well, document it well, redo some stuff, make it work well with FireFox at least.

Just need some time.

Thanks
Title: SelectedIndices ?   
Name: Alphonso
Date: 12/20/2006 8:37:00 AM
Comment:
Thank YOU Bilal.
I couldn't access the SelectedIndices property! I only found SelectedIndex (a single index, int)!
xGrid1.SelectedIndices doesn't exist! Or am I missing something.
Cheers,
PS: Any other "extended" controls like this wonderful xGrid?
Anyone??
Title: Re:   
Name: Bilal Hadiar [MVP]
Date: 12/19/2006 1:42:08 AM
Comment:
Thanks Alphonso,
But guys check out the SelectedIndices property! I guess it will return back all the selected rows!!

Regards
Title: Solved : CheckBoxes   
Name: Alphonso
Date: 12/18/2006 10:57:25 AM
Comment:
Hello again,
I just succeeded in idnetifying the selected rows in the "behind code".
Hope it's useful
foreach (GridViewRow row in this.XGrid1.Rows)
{
CheckBox cb = (CheckBox)row.Cells[0].Controls[0]; // OK
//CheckBox cb = (CheckBox)row.Controls[0]; Doesn't work
if (cb.Checked) {
// Do what ever it is you wanna do
}
}
Title: CheckBoxes   
Name: Andy Sicignano
Date: 12/15/2006 12:35:29 PM
Comment:
Like Alphonso, I'm trying to use the checkbox feature. Adding my own checkbox column isn't nearly as handy because I have to go to edit mode for each row I want to check, and besides, this does not correspond to a database field, but just to an action I want to take for selected rows. But I also don't know how to get to the value of the xGrid checkbox.
Title: Accessing the CheckBoxes   
Name: Alphonso
Date: 12/15/2006 11:20:36 AM
Comment:
Thx Bilal.
I've already made a grid with checkboxes. As you explained I simply loop through the grid's rows to findout which ones are checked. The problem is that I do not know how to do that with your xGrid. when using the classical grid, I add a checkbox control my self (as a coloumn) so that I can access it in the codebehind. But I don't seem to find any "reference" to the checkboxes of xGrid. I tried to find something via code completion but wasn't able to.
Unfortunately the code sample you kindly provide doesn't use the checkboxes at all. That would've helped ;).
Thanks again.
Cheers.
PS: Can anyone point to more "extended controls" just like this wonderfull xGrid ? Please do share.
Title: Re:   
Name: Bilal Hadiar [MVP]
Date: 12/13/2006 7:27:15 AM
Comment:
You can simply loop through all the rows, check the checkbox on each row if selected you add the record to your list!
You also have I guess SelectedIndices!

Regards
Title: Accessing CheckBoxe status ?   
Name: Alphonso
Date: 12/13/2006 6:48:36 AM
Comment:
Hello, and thanks for sharing the xGrid.
I wonder how can one access the checkboxes "values" in the behind-code?
For instance, if I use xGrid to display a list of users and want to be able to send some email to some of them.
I check the checkboxes related to the selected users. Then click one some "send email" button.
On that button's onClick handler I need to access the CheckBox status/value for each row to be able to tell whether or not to send the email.
How is that done?
Thanks again.
Cheers.
Title: databinding to Xgrid doesn't show the grid   
Name: Anuradha
Date: 11/30/2006 4:49:41 PM
Comment:
Hi,

I am trying to bind the data through OnRowDataBound="GridView1_RowDataBound" event in the Xgrid. It looks like this event is firing and binding the data to the grid. However, the grid itself doesn't show up on the screen. Any idea what is going on?

Thanks,
Anu
Title: Extended GridView Control   
Name: poornima
Date: 11/29/2006 2:13:36 AM
Comment:
hey this is really a good1...with all those imp features
Title: Re: senthil   
Name: Bilal Hadiar [MVP]
Date: 11/28/2006 3:36:16 AM
Comment:
Hello:
ContextMenu doesn't work for FireFox! It only works for IE!

If anyone can help in and try to make any trick to let it work, please let me know!

Thanks
Title: context menu problem in firefox   
Name: senthil
Date: 11/28/2006 3:28:20 AM
Comment:
hi,
i have been using xgrid right click for contenxt menu but it is not working in the firefox
any solution plz help

thanks in advance
senthil
Title: Thanx   
Name: Souvik Mitra
Date: 11/20/2006 1:48:27 AM
Comment:
Great work Bilal! I've got the source code from codeplex and will egt into it now...but the sample looks awesome.
Title: Where's the source code?   
Name: Fallon Massey
Date: 11/18/2006 2:16:43 PM
Comment:
Where is the source code for the grid, or the license?
Title: Great Job, but a few questions...   
Name: Paul Raymond
Date: 11/3/2006 4:42:45 PM
Comment:
I did some extensive testing on an ASP.NET web app that I am developing and found that there were a few issues that arrive that don't seem to have been addressed here.
1) First is right-click rendering of the contextMenu. I couldn't seem to get it working with either Firefox (1.5) or Netscape (7.0). I assume that a developer would have to disable the browsers rightclick mechanism for this to work.
2) I've not had luck in getting the insert to show up with rightclick and select add. I was not sure if I have to populate a footer with the required controls, or if it will automatically draw from the edit controls?
3) It does not appear to render (Expecting insert dialog) if bound to an empty SQLDataSource. Perhaps the same reason as #3?
4) Fourth, I've converted your sourcecode to vb (as I am primariliy a VB.NET developer) in order that I could better follow the sourcecode through its travel and thus better understand it. Is that ok with you? I am just starting to test with it so I don't have any feedback as yet.

Thanks for a great step in improving a much needed control.
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 10/30/2006 1:55:15 PM
Comment:
Can you please send me the exception you got from the TrackViewState()? What were you trying to do?

Thanks.
Title: Help Me Please!   
Name: SMHMayboudi@yahoo.com
Date: 10/30/2006 1:48:23 AM
Comment:
I get an error, and I skinid not work probably



[PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("The style applied to the filter section"), Category("Extended GridView Properties")]
public virtual TableItemStyle FilterStyle
{
get
{
if (this.filterStyle == null)
{
this.filterStyle = new TableItemStyle();
}
if (base.IsTrackingViewState)
{
// In Here I Get An Error
//this.filterStyle.TrackViewState();
base.TrackViewState();
}
return this.filterStyle;
}
}
Title: Re: Greg   
Name: Bilal Hadiar [MVP]
Date: 10/26/2006 1:26:57 AM
Comment:
Hello Greg:
First of all thanks for the bug fix. I will update xGrid and upload it to the CodePlex.
But I couldn't get what the problem was? CSS used to hide one column? And so, what happens?

Regards
Title: Bug Fix   
Name: Greg Thomas
Date: 10/25/2006 4:41:14 PM
Comment:
I create a custom gridview with 6 columns and have 1 hidden using CSS. So when HeightFixer runs, it ignores the column CSS style for the previous columns. I fixed the issue with this in XGrid.cs

if (this.enableHeightResolver)
{
GridViewRow gvRow = null;
for (int rows = this.Rows.Count; rows < this.PageSize; rows++)
{
// Create a dummy Row of type DataRow and Normal State
gvRow = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);

for (int columns = 0; columns < this.ActualColumns; columns++)
{
// Add columns with &nbsp; (space) to take a height
TableCell tableCell = new TableCell();
tableCell.CssClass = this.Columns[columns].ItemStyle.CssClass;
tableCell.Controls.Add(new LiteralControl("&nbsp;"));
gvRow.Controls.Add(tableCell);
}

//Inserts the rows right above the footer row.
//Remove the "- 1" if you are not using a footer.
if (this.Rows.Count > 0)
{
this.Controls[0].Controls.AddAt(this.Controls[0].Controls.Count - 1, gvRow);
}
}
}
Title: How to fix header row   
Name: Satish
Date: 10/23/2006 1:25:49 AM
Comment:
Hai,
i am not using paging.but i am using vertical scollbars for showing total data.my problem is i want to fix the header row.

sathishkumarch@pricol.co.in
Title: Sorting, paging problem working with Master Pages   
Name: Paúl Jesús Sánchez
Date: 10/20/2006 11:47:30 AM
Comment:
Hi Bilal, the problem is on the page, but it seems to be an issue with ATLAS. I just remove response.write from the page and replace it with this.page.registerclientscriptblock(function) and all works fine. Regarding Master Pages, Sort, Edit and Delete events just doesn't work but select. For example, the next error is displayed when trying sorting: "The GridView 'XGrid1' fired event Sorting which wasn't handled". I think is a problem with de ClientID (ctl00$ContentPlaceHolder1$XGrid1).
Title: Re: Paul   
Name: Bilal Hadiar [MVP]
Date: 10/20/2006 1:03:56 AM
Comment:
Hi Paul,
What is the "response.write" you are talking about? Is it something inside the xGrid or on the page?

Regarding xGrid in Master Pages, I did try it and it worked fine, what is the problem? you can email me at bilal@bhaidar.net to explain to me more the problem so that i know how to figure it out!

Thanks.
Title: Sorting, paging problem working with Master Pages   
Name: Paúl Jesús Sánchez
Date: 10/19/2006 9:51:04 PM
Comment:
Hi everyone! The problem with the Unknown Error is about the "response.write"...remove it! Now I have another problem using XGrid with Master Pages: I can't sort or paging the grid due an issue with ClientID... (ctl00$ContentPlaceHolder1$XGrid1) Can you please tell me how should I use XGrid with Master Pages? I have to tell you that the XGrid is in a Content Page.

Thanks in advance.
Title: Unknown erro   
Name: Paúl Jesús Sánchez
Date: 10/19/2006 1:48:53 PM
Comment:
When using XGrid inside an UpdatePanel, and select row or click the "delete" or "edit" button I get an "unknown error" pop-up (javascript) message. I see this is an old issue... someone already has the solution for this?

Thanks in advance...
Title: ScrollBars GridView   
Name: Hamdaoui moncef
Date: 10/19/2006 10:18:36 AM
Comment:
Can you please help me to create a scrollbars property fo this gridview control.
thanks.
Title: Developing   
Name: Hiren
Date: 10/16/2006 9:16:42 AM
Comment:
Can you please explain how can i develop same thing bcoz i want to start developing in custom control development

Please if possible than provide us a source code
Title: Re:   
Name: Bilal Haidar
Date: 10/6/2006 2:08:11 PM
Comment:
Download the accompaning sample in this article. It has the Grid dll!!

Regards
Title: source or dll   
Name: Eric
Date: 10/6/2006 1:02:24 PM
Comment:
just have to read and follow the download link.... some times you just feel super smart!
Title: source or dll   
Name: Eric
Date: 10/6/2006 12:55:39 PM
Comment:
where can i find the source or a dll for the xGrid? codeplex has no releases of the source and i don't see one here either.

e.
Title: Re: Eric   
Name: Bilal Hadiar [MVP]
Date: 10/6/2006 6:25:24 AM
Comment:
Eric,
You don't need to do anything. It is done automatically for you!!

In the next release of this Grid, I will add a property to control this behavior!!

Hopefully, one month from now, I will have updated some stuff and I will upload the project to CodePlex with the sourcecode!!

Regards
Title: Fix GridView height when number of rows < page size   
Name: Eric
Date: 10/5/2006 10:51:46 PM
Comment:
You talk about this feature, but what do i need to do to set this, it's driving me crazy.
Title: congratulations   
Name: Fabian
Date: 9/20/2006 10:34:18 AM
Comment:
congratulations for you all! I always think by myself.. the best are also the more simple, the more clear, your site is simple, clear, and the code presented are the best.. you put together all Ive searched for weeks about the gridview control. thanks for you all. Fabian from BRAZIL.
Title: source   
Name: Dave
Date: 9/18/2006 5:09:07 AM
Comment:
I really need the source code here as it looks like this project could vanish and I need to disable the fixed size feature, please please give us the source!!!!
Title: OnRowClick and EditItemIndex   
Name: Alexander Megas
Date: 9/18/2006 4:20:56 AM
Comment:
I tried to make the OnRowClick event set the row to be edited, so the user just clicks a row, makes updates and clicks away. The problem is when the click a textbox to enter data, the OnRowCick event happens again, and the datagrid is refreshed and the user loses focus on the textbox (but the row is still edit mode).

Surely this is the main use of the OnRowClick event? My code is something like

if(xgrid1.EditIndex != e.GridViewRow.Index)
xgrid1.EditIndex = e.GridViewRow.Index;
Title: MasterPage problem   
Name: Marc
Date: 9/15/2006 8:56:47 AM
Comment:
Nice work!

I used the sample of the dl section, but the Masterpage problem still persist?

Or is there any other download with the fix in it?

regards
Marc
Title: Nice   
Name: Dave
Date: 9/8/2006 9:46:36 AM
Comment:
This is a great control! One issue...I really need to use paging but really don’t need to let it keep a fixed size (I stack data grids and have them doing different things but to the user they look like one) this feature makes it difficult for me to use so an option to disable this would be most welcome!
Title: master page fix   
Name: Gian Di Loreto
Date: 9/7/2006 5:01:46 PM
Comment:
Congratulations and thanks for all your fine work. I'm using your xgrid now and I love it.

Not to belabor this point, but you mention that you've fixed the master page problem but I can't find the updated .dll anywhere on your site. Is it available anywhere for download?
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 9/7/2006 8:02:18 AM
Comment:
The dll can be downloaded in this article.
Couldn't you find it? It is called CustomControls.dll if not mistaken!!

Regards
Title: Great Work !   
Name: George
Date: 9/5/2006 10:54:17 AM
Comment:
How can i add this great control to my toolbox ? I suppose i need a dll file but i don’t know where is it.
Sorry Rookie…….. thanks
Title: Codeplex   
Name: Eric
Date: 8/31/2006 9:38:20 AM
Comment:
Hi Bilal. Great work. Sad what happens to your country.
Is there any chance to have the updated xgrid source posted in codeplex? I can't see any releases
Title: Great Work!   
Name: Nate
Date: 8/30/2006 6:34:53 PM
Comment:
Great work!!

I really like this control, i think I will use it every time instead of the gridview. Is there a way to turn off the "Fix GridView height when number of rows < page size"? There are some situations where I would want it off.
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 8/30/2006 5:26:02 PM
Comment:
Thank you so much, I am so honored by all those comments!!
I am still outside my country because of the war we had lately! Once I am back and stable, I will follow up on every comment you gave me and hopefully we will improve the control together!!

Regards
Title: Outstanding Extended GridView Control!   
Name: Skerstiens
Date: 8/30/2006 4:11:07 PM
Comment:
This is excellent! I've implemented about 50% of these extensions to the gridview in my code over the past couple months in non-standard ways and on an ad-hoc as needed basis. Thank you for developing a control to encapsulate all of these improvements. I can't wait to see the source code. This code is a real timesaver. Thanks very much! Please post again when you have put the source code on codeplex. Once that code is available I will feel comfortable using this in all my Web apps moving forward. Great job and thanks again!
Title: xGrid in Skinfile   
Name: Damenace
Date: 8/30/2006 1:57:20 PM
Comment:
Great control Bilal. Is it possible to put it in a skinfile too? I ve tried to create one, but without any luck.
Title: Re: Code   
Name: Bilal Haidar [MVP]
Date: 8/30/2006 4:30:12 AM
Comment:
Hello,
I am preparing the code to post it on CodePlex.

Thanks.
Title: source available?   
Name: swin
Date: 8/30/2006 4:05:46 AM
Comment:
is the source for the xgrid available?
Title: Re: Jean   
Name: Bilal Haidar [MVP]
Date: 8/29/2006 1:16:27 AM
Comment:
Hello,
Offcourse you can, just follow the same technique used with SQLDataSource and it shall work fine!!

Regards
Title: Save me from this Problem   
Name: Hyangyong Lee
Date: 8/28/2006 11:24:49 PM
Comment:
Why don't you using Web UserControl inteaded with textbox in gridview or formview?

There is not communication between your default controls and maded Web UserControl...

if i use my web usercontrol in gridview or formview, what do i do?
Title: Thanks a lot!   
Name: Hyangyong Lee
Date: 8/28/2006 11:00:53 PM
Comment:
Frankly speaking, I have thought Gridview is not better than Datagrid in ASP.NET 1.0. but now your documents wake up me powerful gridview's enhancement with less code..

but I have a question gridview's design that is not yet good! for example , gridline's color changing, Headtitle's 3D design ...
Title: ObjectDataSource?   
Name: Jean-François
Date: 8/28/2006 5:59:44 PM
Comment:
Great job!

Would it be possible to use the xGrid control with an Object Data Source instead of an Sql Data Source?

Best regards,

Jean-François
Title: Very good work   
Name: Shahnawaz Khan
Date: 8/28/2006 6:29:48 AM
Comment:
You get me Bilal, what I'm looking for. Really a good one. Keep coding and sharing.

Regards!
Shahnawaz Khan
Title: Re: Josiah   
Name: Bilal Haidar [MVP]
Date: 8/27/2006 5:47:26 AM
Comment:
Hello,
That is a great idea.
Can you please send me an email to bilal at bhaidar.net and explain in details how you would like it to be?

Thanks.
Title: Source Code available in VB?   
Name: Josiah
Date: 8/27/2006 5:34:52 AM
Comment:
Hi Bilal,

I am really exited to see someone trying so hard to extend the gridview functions. I would like to know if you can also provide the source code in VB? Can I filter the rows to be displayed by setting filtering rules in multi-columns like those in Excel?

Thanks a lot,
Josiah
Title: Excellent Wok Bilal Haidar   
Name: AzamSharp
Date: 8/26/2006 1:24:42 PM
Comment:
Hi Bilal,

Excellent work!!!

Thanks,
Azam
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 8/26/2006 8:04:46 AM
Comment:
I didn't try it yet with ATLAS.
What you can do is try to know what is causing this error, is it some JS inside the xGrid or external (ATLAS)?

Thanks,
Title: Atlas CTP July - Unknown Error   
Name: Michael Holm Andersen
Date: 8/26/2006 7:40:46 AM
Comment:
Hi,

I've downloaded the (nice) Grid and is trying to use it inside an UpdatePanel, but when I click the "delete" or "edit" button I get an "unknown error" pop-up (javascript) message.

Any ideas?

Best regards,
Michael
Title: Re: Re: MasterPage problem   
Name: Ivan Barbaric
Date: 8/25/2006 12:48:21 AM
Comment:
Bilal, I see you solved the MasterPage problem. The problem was probably referencing ContextMenu control in JavaScript using ClientID which is generated by ASP.NET differently (ASP.NET adds ctl00_ContentPlaceHolderxx as a prefix to ClientID) when you use MasterPage solution. I read your reply too late, so I used it in IFrame to avoid this problem. BTW, you should be really proud of your work because I am using your control in my Master of science diploma work, my mentor is thrilled with the xGrid.
Title: xGrid on Content-Page problem   
Name: Uwe
Date: 8/24/2006 11:46:49 AM
Comment:
Hi Sameer,

the control-collection is really great -
thank you for making them publicly available!

I started working with it and I learned to love it because
it is pretty intuitive and has almost every feature I need.

Digging a bit deeper into it I noticed the following issues:

Background:
- It is a website containing master- and content-pages
- Atlas UpdatePanels are used
- Multiple xGrid-Views exist on each content-page

The first problem seems to be related to the
"xGrid on Masterpage problem". The browser reports
"ContextMenu1_Root is undefined". But the control is
not located on a master-page but on a content-page.

Next issue:
The xGrid-View has (Templated) Linkbutton's - but
the corresponding event does not get triggered as soon
as the "EnableRowClick" is set to "True".
I have a strange feeling that this problem appears
due to the atlas-toolkit - but I'm not sure.

Do you have any idea or workaround for these issues?

Thank you in advance, best regards, Uwe
Title: Re: Veni   
Name: Veni
Date: 8/23/2006 12:21:57 AM
Comment:
Hi

Is there any solution to implement RowDoubleClick and RowClick events together.
If both clicks enabled, only RowClick will work. Same case for SelectedIndex and RowDoubleClick events.Here SelectedIndex event works fine.But the RowDoubleClick not.....

Thanks
Veni
Title: Re: javascript onMouseOver   
Name: Wendi Taranto
Date: 8/22/2006 11:19:29 AM
Comment:
Thanks Bilal. This property would be helpful.
Title: Re: Veni   
Name: Bilal Haidar [MVP]
Date: 8/22/2006 10:26:37 AM
Comment:
Veni, can you illustrate more please?

Regards
Title: Re: Wendi   
Name: Bilal Haidar [MVP]
Date: 8/22/2006 10:25:49 AM
Comment:
Hello Wendi,
I guess this doesn't work right now because I already implemented the OnMouseOver.
However, I can Add a property to the xGrid that allows you to enter the javascript code to have on MouseOver, does this help?

Regards
Title: javascript onMouseOver   
Name: Wendi Taranto
Date: 8/22/2006 10:10:14 AM
Comment:
When using the asp.net 2.0 gridview control, I had the following line of code in the gridview's RowDataBound event handler:

e.Row.Attributes.Add("onMouseOver", "this.style.cursor='hand';")

This no longer works with xGrid. Can this cursor style be implemented in your xGrid?
Title: RowDoubleClick and RowClick together   
Name: Veni
Date: 8/22/2006 6:02:45 AM
Comment:
One quick question....
Can ou explain how RowDoubleClick can be implemented along with RowClick or SelectedIndexChanged?

Thanks
Veni
Title: SumColumn   
Name: Brad
Date: 8/21/2006 12:18:28 PM
Comment:
Syed Aziz ur Rahman has an interesting extension of datagrid that would be especially useful in gridview. All the examples I have seen to create sums in the footer go through an extended process to capture the data, then format it (not necessarily lining up with the associated columns that are being summed). These other approaches work fine when one or two columns are being summed, but when an entire gridview needs to be summed, it would be helpful to have a column type that included this feature.

While Syed places the titles for each calculation in the new column type, I would prefer that these titles be placed in a column further to the left (and therefore, not repeated for each column that uses this column type).

It was also noted that his code sums only those values that are shown on the particular page (providing page sub-totals). While this may be desirable in many instances, it would be great if there could be a choice to optionally show grand totals as well (totals based on all records collected across all pages -- whatever that criteria may be).
Title: Re: Fixes   
Name: Bilal Haidar [MVP]
Date: 8/21/2006 8:39:31 AM
Comment:
I have done some fixes to the current implementation of the xGrid.
1- I fixed the problem in accessing the ContextMenu when the xGrid is placed in a master page.
2- I made the Filter Textbox accessible, so that you can attach whatever events to it.
3- Regarding, the Row Clicked Index, if you look further, there is the RowClickEventArgs, it contains a property called GridViewRow, that gives you all information needed about the Row Clicked. There is also the RowDoubleClickEventArgs class which has the GridViewRow property.

I will be posting about the changes very soon on my blog: http://bhaidar.net and I will locate the file (dll) where you can download and use.

Hope this helps,
Regards
Title: Re: MasterPage Problem   
Name: Bilal Haidar [MVP]
Date: 8/21/2006 1:53:17 AM
Comment:
Hello,
Can you please send me the projects where you are using the MasterPage and the xGrid?
You can email them to bilal at bhaidar.net

Thanks,
Title: xGrid on Masterpage problem   
Name: Ivan Barbaric
Date: 8/19/2006 5:26:28 AM
Comment:
Hello,

Is there any way to use xGrid control on the Masterpage with the ContextMenu? ASP.NET during runtime searches for "root_ContextMenu1" but such control doesn't exist. When I debug I see the ClientID is "ctl00_ContextMenu1". When I use normal page ClientID is "ContextMenu1" which is OK.

Any comment on this subject would be greatly appreciated!
Title: idx col clicked and master page uses   
Name: hervé
Date: 8/16/2006 9:16:11 AM
Comment:
Very nice functionalities added.
:o)

One question and one comment :

Question :
Can you add the index of the column clicked ?

Comment :
When you use a masterpage, you can only access by code behind to the body tag.
But even when you add dynamically on the body tag the onkeypress and onclick, the context menu doesn't work on the content page using the masterpage.
Is there a way to avoid to use the onkeypress and onclick on the body tag ?
Title: Re: Sameer   
Name: Bilal Haidar [MVP]
Date: 8/14/2006 12:37:44 PM
Comment:
Hi Sameer:
Honestly, I don't remember now the Id and I don't have access to the code.
Enable the Filter, check the HTML to know the ID.

hth,
Regards
Title: Too good work Bilal   
Name: Sameer Shah
Date: 8/14/2006 7:03:25 AM
Comment:
Hi,

I must say you people have done nothing less then extraordinary work.I just want know whather it is possible to expose the id property of filter textbox of xGrid so that auto complete feature of atlas can be incorporate in the filter textbox of xGrid.Again this is excellent work done by you.
Thanks,
Sameer
Title: Good work Bilal   
Name: Simone Busoli
Date: 8/10/2006 10:05:06 AM
Comment:
You all made a great work Bilal, this is maybe the best implementation of an extended DataGrid/GridView I've seen in a lot of time.
Title: Further Development   
Name: Michael Norton
Date: 8/9/2006 10:25:30 AM
Comment:
I have began work on a similar project and would like to compare your code against mine.
I have a few features in mine that are not included in yours. With a little massaging I believe we could make a very nice GridView.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 10/25/2014 2:56:32 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search