“Imagination is more important than knowledge. For while knowledge defines all we currently know and understand, imagination points to all we might yet discover and create.” - Albert Einstein


A new build release (Build 20100207) of CoolControls is now available at codeplex. Build 20100207 contains the following changes:

  • COLGROUP and COL is back! These are generated for the header, table content and footer. This feature can align the header and table cell's width of CoolGridView.
  • AllowResizeColumn property is added to CoolGridView. Set this property to true to enable user to resize  the columnns manually, set it to false to disable. The default value of this property if true.

Labels: , , ,

 Subscribe to feed

CoolGridView February 2010 Release

The newest release of CoolGridView is available for download. There are a handful enhancements, optimizations and bug fixes in this release. Here are the ones worth mentioning.

DefaultColumnWidth Property

You can now define the default column width of CoolGridView columns through the DefaultColumnWidth property. The value for this property can not be of type UnitType.Percentage. On older releases of CoolControls, if a HeaderStyle-Width is not defined for a data column, it defaults to 100px. This value is hard coded inside the control. Now you can specify your own default column width. I got a lot of requests to allow column and table widths to be specified in percentage. Allowing column or table widths to be in percentage and at the same time making sure that the column widths can still be resized by the properly is a great challenge. However, rest assured that I am not dropping this request and that the development of this functionality is still being considered.

SPAN inside Table Cell

There was a bug in CoolGridView when displayed in IE 6 and 7. It was reported by developers that it seems that the style "white-space:nowrap" does not behave properly when applied to TD and TH element when the "width" is also defined in the style. Consider the following code:
<table style="table-layout:fixed;width:90px" border="1">
 <tr>
  <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td>
  <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td>
  <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td>
 </tr>
</table>
If you view the code above in IE 6 or 7, you will see that the text inside the cell wraps and breaks on white spaces even though the style was set not to wrap on white spaces. The fix for this is to put a SPAN that encloses the text inside the cell and put the style "white-space:nowrap" on the SPAN instead of the TD. The code below now works properly in IE 6 or 7. CoolGridView uses something similar to this but uses CSS instead.

<table style="table-layout:fixed;width:90px" border="1">
 <tr>
  <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td>
  <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td>
  <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td>
 </tr>
</table>

"Gradient" Theme

There is a theme included in the sample project in this release that gives a 3D look on the table headers. In this theme, the white spaces inside the cell is not set to wrapped. When user resizes the column width and if text does not fit inside the cell, ellipsis will appear at the end of the text to indicate that there are portion of the text that is hidden.


To use this theme, you have to copy the "Gradient" folder into your "App_Themes" directory and copy the headerbg.gif file into your website in the location "\images\". Set EnableTheming to "True" for your ASPX page and set the Theme property to "Gradient".



COLGROUP and COL Elements Removed

Older releases of CoolGridView generates COLGROUP and COL html tags to control the column widths. However, the control does not render properly in the browser if the entire cells for a column is hidden using the style "display: none". Therefore, COLGROUP and COL were removed.

For more information of what are the other changes, you can read the release notes included in the latest build.

Have a great week everyone!

Labels: , , , , , , , , ,

 Subscribe to feed

I am pleased to announce that CoolGridView control for ASP.NET 2.0 now allows user-resizable columns and it remembers the current scroll position and column widths after a postback or callback.

You can download the latest release at Codeplex.com. Here are the following changes in this release (Build 20100124). Please take note that item #1 and #2 and breaking changes. If you are going to replace your CoolGridView from old releases with this new one, please modify your code according to the instructions provided.

  1. CoolCore.js and CoolCore.cs were added to IdeaSparx.CoolControls.Web project.
  2. If you are using CoolGridView inside an UpdatePanel, the add-on script is not needed anymore. You should remove the JavaScript code (as shown here) from your ASPX page. This functionality is now fully integrated in the CoolGridView control.
    //Remove this JavaScript from your ASPX
    function AjaxEndRequestHandler(sender, args) {
        var p = sender._updatePanelClientIDs;
        if (p != null)
        for (var j = 0; j < p.length; j++) {
            var scripts = $get(p[j]).getElementsByTagName("script");
            // .text is necessary for IE.
            for (var i = 0; i < scripts.length; i++) {
                try {
                    eval(scripts[i].innerHTML || scripts[i].text);
                } catch (e2) { }
            }
        }
    }
    
    try {Sys.WebForms.PageRequestManager.getInstance() .add_endRequest(AjaxEndRequestHandler);
    }catch (e) { }
    
  3. User can resize column headers' width.
  4. Column header and scroll position are preserved after a postback or callback.
What a great way to start the week!

Have a great Monday everyone.

Labels: , , , , , , , , , , , , ,

 Subscribe to feed

Data Bind CoolGridView to IQueryable<>

I recently received a question about how to data bind CoolGridView to an object of type IQueryable<> with automatic sorting and paging. CoolGridView extends ASP.NET GridView control. GridView does not directly support DataSource of type IQueryable<>, and the same is true for CoolGridView. We can use LinqDataSource control to bridge the gap. Quickly bind CoolGridView control to IQueryable<> with automatic sorting and paging capability by following these easy steps.

  1. Drop a CoolGridView and a LinqDataSource control into your ASPX page.
  2. In the "Properties" toolbox, set the DataSourceID of CoolGridView to point to your LinqDataSource control. Set the properties of CoolGridView control to the following:
    • AllowPaging : True
    • AllowSorting : True
  3. Handle the "Selecting" event of LinqDataSource
  4. In the "Selecting" event handler, call your method that returns an IQueryable<> object and assign it to the event argument's property "e.Result".
There you have it!

Have a great weekend everyone.

Labels: , , , , ,

 Subscribe to feed

Down Memory Lane - How this idea sparked


Four months back I started this blog and my open-source project - IdeaSparx CoolControls. I am a fan of ASP.NET 2.0 GridView. In my opinion it is simple yet flexible, plain yet lightweight, unsophisticated yet powerful. GridView control is well designed that it is easy to customize and extend. Not only that, it is also possible to extend GridView so that it can nearly match any popular and commercially available third-party controls out there. The only thing, of course, is that it requires a lot of work. But the huge amount of "sweat" i put into this is all worth it. I have this monumental dream which I planned out in my head that someday, somewhere, somehow (haha, now i am being a bit melodramatic..)  the ASP.NET community will have an open-source alternative over the commercially available grid controls. Therefore, I named this dream project - IdeaSparx CoolControls.

All About IdeaSparx CoolControls

One of its controls is CoolGridView which extends ASP.NET 2.0 GridView. At the end of 2009, CoolGridView was able to render GridView with fixed header, footer or pager and scrollable content. Now think about these features - resizable columns, rearrange columns, present hierarchical data, selective area reloading through AJAX, feature-rich Visual Studio designer support, sorting using multiple columns, data grouping, data binding tools for complex data structures, enhanced data editing and delivery of data-pages through streaming. I think these features are very much possible! Don't you think its cool? (hence, the name CoolGridView, by the way :)  my next installment - having a CoolGridView with resizable columns is already on the way.

Thinking Ahead : To Infinity and beyond..

This year I have decided to jump a little higher and put a little more "sweat" into the project. And surely I will be blogging more about it. But I cannot run the next mile alone.. I need your help. Your inputs are very valuable (not to mention, it boosts my confidence from zero to maybe, 10). Whenever I log on and see a few comments which meant somebody out there finds this dream of mine workable, doable.. possible, I literally dash to my work desk and start pounding on my keyboard and try to do my best to keep you all in the loop of things.

I am glad to tell everyone that because of the recent string of feedback I received in the past couple of months, we were able to make CoolGridView more stable . We were able to make sure that the features worked perfectly on different browsers - Internet Explorer 8/7/6, Firefox 3.5/3.0, Safari and Chrome. This was made possible because you have all used the control and provided feedback. It's Teamwork, i guess so I thank you. I am indeed very grateful.

I hope that you would all stand by me in making this distant dream of mine a reality. This year let's create a CoolGridView control that is easy to use and packed with lots of useful features.

"To infinity and beyond..."

Labels: , , , , , , , , ,

 Subscribe to feed


John Eric Sobrepena

John Eric Sobrepena
Hi, I am an I.T. professional who loves technology. I am right now into C#, ASP.NET, WPF and Silverlight. Photography is just one of my many hobbies.
Bookmark and Share

Type your Email

Follow me on Twitter.
  • COLGROUP and COL is back! This look like a regregression to me. There will be a workaround for those using diplay:none css properties? - Anonymous Dario | Tuesday, 09 February, 2010
  • Dario, Yes, there will be a property that will be introduced to CoolGridView to hide even the COL element. I will be posting on this soon. - Blogger John Eric Sobrepena | Tuesday, 09 February, 2010
  • Good to known.
    Many thanks - Anonymous Dario | Wednesday, 10 February, 2010
  • it's a great object, unfortunnely i need to use it inside a container and has a problem.
    if my .aspx has a master page and i put this object inside the asp:content then gives me an error.
    i'm not a great developer and i can't find a solution..

    and escuse my english please.

    Thaks in advance - Anonymous Raul Mata | Thursday, 11 February, 2010
  • Hi Raul Mata, I tried it and it worked fine for me. Could you tell me the exact error you are getting? You can post it here. - Blogger John Eric Sobrepena | Thursday, 11 February, 2010
  • I am using it and it works great. Saved me a lot of time and headaches, keep up the good work its excellent. - OpenID simonhibbard | Friday, 19 February, 2010
  • How can I have the column width auto adjust the the data row's contents? - Blogger Ryan Andres | Thursday, 25 March, 2010
  • This is not going well with resolution 1280 * 768 here it is showing empty space between scroll and columns.
    can please give me any suggestion for this....... - Anonymous Anonymous | Wednesday, 07 April, 2010
  • Hi Anonymouse, can you provide the browser you are using? Is it IE 6, IE 7, IE 8, Firefox 3.6, Firefox 3.1 or Chrome 4? Email me a screen shot. That will be helpful. - Blogger John Eric Sobrepena | Wednesday, 07 April, 2010
  • Hi John,
    Is there a way to specify an exact width to a specific column?
    This function seems not work?

    Am I missing anything? - Anonymous Mahmoud | Monday, 12 April, 2010
  • Hi,

    how i can attach event pageindexchanging inside this gridiview controls, so we no need to delegate event in page init (event sorting too) - Anonymous Stranger | Wednesday, 14 April, 2010
  • Hi John,

    Great control, small issue:

    The table width of an empty data template or text is 0 meaning only the first character is shown. - Anonymous PMc | Friday, 16 April, 2010
  • Excellent Control John, works great in runtime, however during design time it will not render the control.

    Error is:
    There was an error rendering the control.
    Object reference not set to an instance of an object.

    Any hints?

    Doc - Blogger Dagdason | Monday, 26 April, 2010
  • Hi Dagdason, Can you tell me the Visual Studio version and the OS version you are using. Send me a sample project showing the issue, that will be a great help for me to help you out. Thanks for using the control :-) - Blogger John Eric Sobrepena | Monday, 26 April, 2010
  • VS 2008, XP SP 3 (Soon to be Win 7)

    Do you have an email address to forward code and screen prints?

    My gmail is dagdason@gmail.com - Blogger Dagdason | Tuesday, 27 April, 2010
  • Update -

    So John - I played with the component a bit and found the following to be true.

    First try -
    I created a new web project, added references for Ajax and CoolControls.

    On default page I added ScriptManager, then UpdatePanel and CoolGridView controls. CoolGridView rendered perfectly in design mode.

    second try -
    Created new web project and added references for Ajax and Cool Controls
    Created Master Page
    Created Default Page (Child to Master)
    Added ScriptManager, UpdatePanel and CoolGridView to ContentPlaceHolder1 section of Default Page
    CoolGridView control would not render

    Hope this helps

    :D - Blogger Dagdason | Tuesday, 27 April, 2010
  • I cannot move to gridview. I am using Datagrid. Can i integrate your code in my datagrid ? is that easy ?
    do let me know
    thanks - Blogger Atoms | Monday, 31 May, 2010
  • more...more...
    we need more... - Anonymous Anonymous | Sunday, 06 June, 2010
  • Hi,
    I want to fix the column, when i scroll the bottom right in the table.. for all browser how can i do. But, i have done with IE. I need other browser, i have used in this,
    position:relative;
    left:expression(this.offsetParent.scrollLeft);
    z-index:1;

    Thanks in Advance,
    Maniraj - OpenID Motta Thambu Family (Sobanapuram) | Friday, 18 June, 2010
  • No matter what I do, the header is always a little to the right to the columns. I'm using IE8/Chrome/Firefox. - Anonymous Anonymous | Tuesday, 06 July, 2010
  • Many thanks to this! Awesome work!!!!

    Does anyone know the trick: in IE6 the header of coolGridView isn't scrolling horizontally as it does in almost all other browsers. Does anyone have a fix for that?

    @John Eric Sobrepena: Is this project still in progress? Will you have the time to do some next releases? I would strongly appreciate it. This is just the best thing I found in 2010. Keep it up.

    Bye - Anonymous coolGridViewer | Thursday, 29 July, 2010
  • John,

    First, I wanted to thank you for this little gem. When I suddenly had to replace an ancient grid in order for it to work in non-IE browsers, this was my lifeline.

    However, I had a little trouble with the embedded resources: I actually subclassed the CoolGridView (to add standard styling and a bit of client-side behaviour) and suddenly the embedded resources threw an error "This is an invalid webresource request".

    This, of course, happened because my subclassed CoolWebGrid was in a different assembly from the resources. I solved the problem overriding CoolWebGrid.OnLoad thus:

    protected override void OnLoad(System.EventArgs e)
    {
    String _url;

    if (! Page.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "CoolCore.js"))
    {
    _url = Page.ClientScript.GetWebResourceUrl(this.GetType().BaseType, "IdeaSparx.CoolControls.Web.CoolCore.js");
    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "CoolCore.js", _url);
    }

    if (! Page.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "CoolGridView.js"))
    {
    _url = Page.ClientScript.GetWebResourceUrl(this.GetType().BaseType, "IdeaSparx.CoolControls.Web.CoolGridView.js");
    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "CoolGridView.js", _url);
    }

    base.OnLoad(e);
    }

    I just wanted to put the code here for anyone who has the same problem I did. It's not a bug, so there's nothing to fix in the assembly proper; it's just a gotcha. Also, excuse the messy formatting; I can't format the code with a <code> tag.

    Cheers! - Blogger Tiago | Tuesday, 17 August, 2010
  • John,

    Very nice job with this user control! The functionality was exactly what I was looking for in the GridView and not finding. I will probably use this object throughout our entire web project! Thanks!

    Jason - Anonymous Anonymous | Thursday, 02 December, 2010
  • Hello!

    Is there any possibility to set column width in percent? - Blogger Michael | Friday, 11 February, 2011
  • Thank you so much for sharing this cool control John!

    I have a little problem though, the postback caused the gridview back to the original position, even after I set:
    MaintainScrollPositionOnPostback="true", any idea how to keep current position after postback?

    Thank you so much again for your excellent job!

    Melania - Anonymous Anonymous | Friday, 11 February, 2011
  • This is a great solution to my problem. Thank you very much. The only question I would have is if it's going to implement fixed Columns. So you could add a parameter of number columns fixed and that number from the left would be fixed.

    I am really enjoying he speed of this control. thank you again.
    Jason - Anonymous Anonymous | Tuesday, 12 April, 2011
  • One problem, I've got a tab panel with two tabs.

    The scrollable grid view is on one of the tabs. If the tab with the gridview is not the first tab, then scrollable part does not work. If you tab to the other tab and back, then the scroll does not work.

    Any suggestions??
    chuck - Blogger MrWoodChuck | Wednesday, 01 June, 2011
  • I get the same result as MrWoodChuck, having multiple panels and the control not rendering in design mode. Any suggestions? Otherwise very useful control. - Anonymous Anonymous | Sunday, 07 August, 2011
  • Great Tools! Thanks, - Anonymous Anonymous | Wednesday, 07 December, 2011
  • Just simply great work, many thanks sir! - Anonymous Anonymous | Monday, 23 January, 2012
  • Does this control (CoolGridView) not work with part of a project that contains a site.master? It seems when I add it to a page that has a master page, it fails. - Blogger Gary Bledsoe | Tuesday, 07 February, 2012
  • You're the man, John! Great job!
    Missing the feature of keeping scroll position on callback made me leave your control, but after all these updates and new features, I've returned it in my app. So far, it's ok, I don't have any complaint and my users are happier without paging navigation.
    I'll test more extensively it next period.
    Just a note: if ItemStyle in BoundField has CssClass with padding defined (for example, 10px on the right), and HeaderStyle has none, width of the header and rest of the column is different (for that 10px). - Anonymous RaVel | Tuesday, 02 February, 2010
  • That's great to hear RaVel. And I am taking note and investigating what you reported about ItemStyle and HeaderStyle causing inconsistency in the widths.

    Your feedback is highly appreciated. - Blogger John Eric Sobrepena | Tuesday, 02 February, 2010
  • Is there an option to freeze the footer at well also? I am going to be needing to sum up certain columns and have them display totals. Thank you.

    Denny - Blogger Denny Smolinski | Friday, 18 June, 2010
  • Thanks for the great control. I'm having a problem running in IE8 and FF where the scroll bars are not showing when the control is in a panel with a ModalPopupExtender. Without the ModalPopupExtender everthing works great. Everything works good on IE7 and IE8 in IE7 mode.

    pt. - Anonymous Anonymous | Tuesday, 27 July, 2010
  • Can CoolGridView create columns based on the dataset/table bound to it? Or do the columns have to be created in the markup? - Blogger ununiqueid | Monday, 25 January, 2010
  • Hi ununiqueid, CoolGridView extends ASP.NET 2.0 GridView under the hood. So the answer to your question is "Yes" it can take the columns based on DataSet/DataTable. - Blogger John Eric Sobrepena | Monday, 25 January, 2010
  • Good to see quick improvement - Anonymous Dario | Tuesday, 26 January, 2010
  • With everyones help and your feedback, we should be able to slowly stabilize this control and promote it to "Beta" and then to a "Stable" release.

    Hierarchical data presentation is now on the works :-) Stay tuned everyone. - Blogger John Eric Sobrepena | Tuesday, 26 January, 2010
  • A very impressive feature: using cookies for preserving scroll position so user can log-off and log-in without losing his setting. - Anonymous dario | Tuesday, 26 January, 2010
  • That is a good suggestion Dario. I will keep a note of that in the future releases of CoolControls. How is the new CoolGridView control working for you so far? - Blogger John Eric Sobrepena | Tuesday, 26 January, 2010
  • I have some problems due to bad css. I'm busy tryng to fix. Different matter then the hidded column (you have a mail in this regard). - Anonymous Dario | Tuesday, 26 January, 2010
  • Hello mate!

    Thanks a lot for ya control, after few arrangements works great on every browser appart safari where it's impossible to change size of the columns.
    Do you have any suggestions ? - Blogger jo | Saturday, 30 January, 2010
  • Hi Jo, I am glad to hear that the control worked for you. Regarding changing the size of the columns, could you elaborate on this more. Resizing the column width by a user was also tested to work in Safari 4.0. - Blogger John Eric Sobrepena | Saturday, 30 January, 2010
  • Hi. I'm experimenting with this Cool GridView of yours. It appears to be very useful!

    My data source is a dataTable with two label columns and a user-input-controlled number of value columns. Since the number of data columns is dynamic, I have to (?) use the setting AutoGenerateColumns="true" for the CoolGridview.

    I have set a default Width that is appropriate for all value columns. However, for the two Label columns to the left in my coolgridview I want to specify a different width which is impossible(?) in the code-behind (C#), since the collection of columns does not have any members when I have not defined the columns explicitly.

    Is there an easy way of setting width to specific columns under the above cicumstances?

    I'm also interested in tips in how to freeze one or more columns from scrolling in the same way as the header row.

    Best regards,
    //Anders - Anonymous Anders | Friday, 26 February, 2010
  • Hi John,

    We are using cool GridView in our project. It is very useful. We require pager to be modified and would want to provide dropdownlist box with number of records per page. Change the number of record per page on change event of dropdown and show selected 10 or 50 or 100 records etc.

    Can you please help us to work on this.

    Thanks,
    Angna - Anonymous Anonymous | Wednesday, 30 March, 2011
  • hai john

    I am Using this Control..its nice but it does not working with onrowediting event.
    can we do edit, update,cancel,delete
    i tryed for edit but the event _RowEditing is not working...

    can you suggest me the solution for this problem...plz - Anonymous Anonymous | Tuesday, 21 June, 2011
  • Hi John, nice control and it's working great with no issues when replacing the original .net GridView. I'm using it in a time keeping app that's a replacement for Sage Timesheet. I have links in the header for days of the week and in the first column for employee name. My question is when a user clicks those links if there's a way to return the grid scroll position to where it was previously. Maybe an option for cookies/session variables that Dario suggests above? - Anonymous Anonymous | Tuesday, 28 June, 2011
  • Hi John,

    We are using cool GridView in our project. It is very useful. It is working very nicely but I got one problem with grid header when user search for any header value then header moves for display the search but data values do not move.

    Can you please help us to work on this?

    Thanks,
    Sachin - Blogger Sachin | Tuesday, 05 July, 2011
  • Hi John

    I am happy with the control. There is one problem. My errorlog is filleing with file not found problems.

    System.Web.HttpException: File does not exist.
    at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
    at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context)
    at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    What am I missing?

    regards

    Michel J - Anonymous Michel | Friday, 26 August, 2011
  • i am adding one template field with one label control.
    but i cant find that control at runtime using findcontrol


    what should i do - Blogger bsuresh | Monday, 19 September, 2011
  • Glad to have you with us. The idea of creating and maintaining an open-source alternative over the commercially available grid controls is very brave. I hope you're going to achieve it. Good luck!

    Just to remember, a notice from my last comment, the control will be mostly useless in financial/accounting web apps without a feature of keeping scroll position after having postback or callback.
    I'm looking forward to see this in your control one day. - Anonymous RaVel | Friday, 22 January, 2010
  • Hi RaVel, thank you for your encouragement. Rest assured that your suggestion (maintain scroll position after postback or callback) will most likely be available in the next release together with the feature of users being able to resize columns. - Blogger John Eric Sobrepena | Friday, 22 January, 2010
  • Hi RaVel, You can check out the latest release. It now includes your suggestion to maintain scroll position after a postback or callback.

    CoolGridView New Release : Resizable Column Widths and Keeping Scroll Position - Blogger John Eric Sobrepena | Wednesday, 27 January, 2010
  • Hi John,

    I was wondering if this project was still going on. This is an awesome tool!!

    G - Anonymous Anonymous | Wednesday, 12 May, 2010

Flickr Photostream



 Subscribe to feed


Powered by Blogger



© 2006 IdeaSparx | Blogger Templates by GeckoandFly.
No part of the content or the blog may be reproduced without prior written permission.