Contact
 

 Saturday, December 16, 2006
How to access controls in the child template

The following code in C# works for my sample:

for(int i = 0; i < HG1.Items.Count; i++)
{
    HierarGrid c = (HierarGrid) HG1.Items[i].Cells[1].FindControl("DCP").FindControl("Panel_Author_Title").FindControl("ChildTemplate_Author_Title").FindControl("HG1");
    for(int j = 0; j < c.Items.Count; j++)
    {
        string title = c.Items[j].Cells[2].Text;
    }
}

Remark: “Author_Title” is the name of the DataRelation that I am using.

HierarGrid
12/16/2006 11:04:00 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [5] 


 Friday, May 12, 2006
Version 2.2 of the HierarGrid and DCP

I just published a new version 2.2 of the HierarGrid and the DynamicControlsPlaceholder that hopefully fixes all problems with reloading UserControls under ASP.NET 1.0-2-0. As before, both components are compiled against .NET 1.0 but tested with 1.1 and 2.0.

V2.2.0.0 (published 2006-05-12)

  • Bugfix: Under some conditions, UserControls still could not be reloaded when the application is configured as a website

Download here

DynamicCtrlPlh | HierarGrid
5/12/2006 7:34:48 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [22] 


 Thursday, April 13, 2006
FAQ: Expanding and collapsing rows programmatically

One of the FAQ is "How can I expand/collapse all the rows programmatically?"

The answer is: The HierarGrid has a property called RowExpanded which is of type RowStates and this class has methods for ExpandAll and CollapseAll (e.g. HierarGrid1.RowExpanded.CollapseAll()).
Unfortunately, there is no client-side equivalent for this. (If you should write one, please let me know so I can include it in the next version *g).

HierarGrid
4/13/2006 10:37:22 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [9] 


 Wednesday, January 11, 2006
Another new version of the HierarGrid and DCP for ASP.NET 2.0

I just published another new version 2.1 of the HierarGrid and the DynamicControlsPlaceholder that fixes another problem with ASP.NET 2.0. Please find the detailed changelog on the respective pages. As before, both components are compiled against .NET 1.0 but tested with 1.1 and 2.0.

V2.1.0.0 (published 2006-01-11)

  • Bugfix: UserControls could not be reloaded when the application is configured as a website (as opposed to virt.dir.) (thanks to Keith Culpepper)
  • Bugfix: fixed regression if ShowHeader=false and AllowPaging=false, colspan is wrong (thanks to Stuart Hilbert)

Download here

DynamicCtrlPlh | HierarGrid
1/11/2006 11:14:28 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [30] 


 Monday, December 19, 2005
New HierarGrid and DynamicControlsPlaceholder versions for ASP.NET 2.0

I just posted a new version 2.0 of both the HierarGrid and the DynamicControlsPlaceholder that works with ASP.NET 2.0. As many of you pointed out, the old versions worked with ASP.NET Beta2 but failed under the final version.

If you run into an error message "The file '/.../<WrongFilename>.ascx' does not exist." in any of the two components please download the newest version and try it again.

Sorry for the late response to this problem but I've been on vacation (South Africa, FWIW) the last 4 weeks. :)

Download here

DynamicCtrlPlh | HierarGrid
12/19/2005 9:28:19 AM (W. Europe Standard Time, UTC+01:00)  #  Comments [24] 


 Wednesday, September 28, 2005
Troubleshooting HierarGrid plus/minus icon problems

The most frequent problem regarding the HierarGrid seems to be that the plus/minus icons are not appearing on the page. The reason usually is simple: The DataRelation is not properly set up. If we take a look at the HierarGrid.cs source code you'll notice the following lines:

//if no child rows exist, hide the plus-minus icon
if(panel == null)
    item.Cells[_hierarColumnID].FindControl("Icon").Visible = false;

When is panel == null?

foreach(DataRelation dataRelation in dataRelations)
{
    TemplateDataModes templateDataMode;
...
    if(templateDataMode != TemplateDataModes.None)
    {
        DataRow[] dataRows = drv.Row.GetChildRows(dataRelation);

        if(dataRows.Length != 0)
        {
            //create the panel that contains all the child templates
            if(panel == null)
            {
                panel = new Panel();
...

So, as long as drv.Row.GetChildRows(dataRelation) returns more than one row, the plus/minus icon should be visible.

How can you check your DataRelation?
To show it at the HierarGridDemo take a look at the following block that creates the DataRelation and can be found in Page_Load:

//Relation Title => Sales
dc1 = ds.Tables[0].Columns["title_id"];
dc2 = ds.Tables[2].Columns["title_id"];
dr = new DataRelation("Title_Sales", dc1, dc2, false);
ds.Relations.Add(dr);

Now you can add the line

DataRow[] drs = ds.Tables[0].Rows[0].GetChildRows("Title_Sales");

and see if it returns any rows.

Another option is adding a breakpoint to the TemplateSelection event. This should be called at least once for each DataRelation that has child rows.

HierarGrid
9/28/2005 8:45:43 AM (W. Europe Standard Time, UTC+01:00)  #  Comments [7] 


 Tuesday, September 27, 2005
HierarGrid and StackOverflow exceptions

If you are running into a StackOverflowException when working with nested grids, you'll need to check the code-behind of the child grid.

Make sure that the databinding code for the DataGrid is located in the Page.DataBind event and not in Page.Load or ChildGrid.DataBind.

In the HierarGrid demo on my homepage this can be seen in the TitleList.ascx.cs/.vb.

C#:
private void InitializeComponent()
{
   ...
   this.DataBinding += new System.EventHandler(this.TitleList_DataBinding);
   //not this.HG1.DataBinding or this.Load
}

private void TitleList_DataBinding(object sender, System.EventArgs e)
{
    DataGridItem dgi = (DataGridItem) this.BindingContainer;
    if(!(dgi.DataItem is DataSet))
        throw new ArgumentException("Please change...");
    DataSet ds = (DataSet) dgi.DataItem;
    HG1.DataSource = ds;
    HG1.DataMember = "Titles";
    HG1.DataBind();

}

VB:
Private Sub TitleList_DataBind(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.DataBinding

If you notice any other reason for a StackOverflow exception, please let me know.

HierarGrid
9/27/2005 8:47:42 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [5] 


 Wednesday, August 24, 2005
Defining the Columns in the HierarGrid

Quite regularly I get the question how to hide a specific column in the HierarGrid or how to specify the width of it. The answer is fairly easy: Exactly the same way as with the regular ASP.NET DataGrid.

Turn off AutoGenerateColumns and specify it declaratively:

<dbwc:HierarGrid....>
   <Columns>
      <BoundColumn... >
         <HeaderStyle... />
      </BoundColumn>
   </Columns
</dbwc:HierarGrid>

You can also explicitely define the HierarColumn (which is autogenerated if you don't do so) in the same way:

<dbwc:HierarColumn />

Let me know if you run into any problems with that.

HierarGrid
8/24/2005 6:20:14 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [9] 


 Friday, July 22, 2005
No load-on-demand in HierarGrid

One of the question I get frequently about the HierarGrid is, wether it is possible to load the child data in a delayed manner. Usually, the scenario that people have is that the grid contains too many rows to be rendered and transferred in a timely manner.

However, the basic design principle of the HierarGrid is that all data is rendered to the client at once and expanding/collapsing is done completely on the client side without the need for postbacks.

If the structure is more complicated than it could be rendered at once, the HierarGrid might not be the best choice for the scenario. The only other options to work around this are limiting the data that needs to be rendered per page like e.g. paging, filtering etc.

I received some emails from other people who thought about enhancing the HierarGrid with a delay-loading mechanism (maybe in an AJAX style to pick up that trendy term) but I don't have a complete implementation yet and currently I don't have the time to implement it myself.

One further point: When checking the performance of the page in IE make sure you don't have a debugger attached (for script debugging) because that slows it down dramatically.

HierarGrid
7/22/2005 4:58:20 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [3] 


 Wednesday, March 23, 2005
Updated EditableHierarGrid demo

I've uploaded a new updated version of the EditableHierarGridDemo that shows how to edit rows in the parent grid, the child grid and furthermore how paging and sorting in the child grid works.

A basic principle for this to work is that the child saves its DataSource to the session (or somewhere else) as you can see in the DataBinding event of the child template. Please note that this DataSet is not identical to the DataSet of the parent grid but is a clone that contains only the subset of data that is relevant for the child.

Example:
Authors=>Titles - The main dataset contains five authors and each author has 3 titles. When the HierarGrid is rendered for each author one title template is created. When this child template is called, the DataSet only contains the three titles of the current author (and not all titles and not any authors). In my sample this DataSet is persisted in the Session so that after postbacks in the child grid occur, only the specific grid can be rebound.

To further clarify that, set a breakpoint into the DataBinding event of the child template and open a quickwatch on the DataSet. You'll notice that only ths correct subset of the data is contained.

Download the demo here: http://www.denisbauer.com/ASPNETControls/HierarGrid.aspx

HierarGrid
3/23/2005 11:22:51 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [1] 


 Sunday, December 12, 2004
HierarGrid not working in MAC IE

I got an email from Steve Miller who tries to use the HierarGrid on his MAC in the newest version of Internet Explorer. Unfortunately, he mentions some problems:

  1. It seems like IE has problems with the standard ASP.NET Image tag rendering to <img ... /> instead of <img ...></img> which seems to work.
  2. The other problem is when clicking on the "+" icon, the detail row is not displayed directly below the master row. Instead it is appended to the end of the grid.

As I don't have a MAC myself I was wondering if somebody has ever tried it and can comment on these problems? TIA

HierarGrid
12/12/2004 7:37:40 AM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, December 06, 2004
Why does the DataItem of my HierarGrid contain a DataSet instead of a DataRowView (or vice versa)?

This is still the most frequently asked question that I get via email. The answer is: TemplateDataMode.
Please make sure you set this property to the value that corresponds to your scenario.

In the current version there are two possibilities:

  • SingleRow: For each row in a table a child template is displayed. Therefore in the Databind event of the child control the DataItem contains a DataRowView - the DataRow that corresponds to the current row in the table
  • Table: For each table a child template is displayed like in a nested grid scenario. Therefore in the Databind event of the child control the DataItem contains a DataSet with all child rows that have a relationship to the current parent row.

In one of the next version I'll add a third option to specify the value at runtime. This may be helpful for mixed scenarios where you want to display nested grids for one table and single row templates for another.

Update: Another reason why you might get an InvalidCastException is when you set TemplateDataMode to Table and try to bind the child dataset in the Page_Load event. Please change that to the DataBind event as shown in the NestedHierarGrid demo on my website.

HierarGrid
12/6/2004 9:02:59 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, August 09, 2004
New HierarGrid version 1.7

The new release 1.7 of the HierarGrid contains the following changes:

  • Feature: TemplateDataMode.RunTime makes it possible to choose between SingleRow and Table for each relation at runtime (thanks to Tom Schmidt)
  • Feature: child templates are displayed for rows in selected state (thanks to Patrick Martin)
  • Bugfix: state of Checkboxes in child templates is now correctly preserved (thanks to Paolo Falabella)
  • Bugfix: corrected Mozilla DHTML incompatibilities (thanks to David Tétreault)

Download here.

HierarGrid
8/9/2004 12:45:40 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Friday, July 09, 2004
Feedback and question mails vs. SPAM

If you send me an email and wonder why I never get back to you, maybe it has been stuck in my SPAM filter. My mail software blocks and sends me a list of all potential SPAM and virus mails and I just skim the subjects. So please make sure you DON'T use a trivial subject like "question" or "hi" and rather include "HierarGrid", "ASP.NET" or whatever might catch my attention.

DynamicCtrlPlh | HierarGrid | Version Switcher
7/9/2004 3:58:30 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Thursday, June 17, 2004
Cryptographic failure when recompiling the HierarGrid, DCP, FileDisassembler etc.

I've been asked twice in the last 24h about the following error when trying to create your own build of the HierarGrid or any other of my components:

error CS1548: Cryptographic failure while signing assembly 'DBauer.Web.UI.WebControls.HierarGrid.dll'
-- 'Error reading key file '..\..\..\DBauer.Web.UI.WebControls.snk' -- The system cannot find the file specified. '

This happens because all builds that I compile are strong named and signed with my private key. The reference to my private key is located in the AssemblyInfo.cs file. Therefore, if you want to recompile the HierarGrid please either remove the reference to my keyfile in the AssemblyInfo.cs or create your own private key and use it to sign the assembly.

Further information on creating a key and strong named assemblies can be found here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconStrong-NamedAssemblies.asp

FileDisassembler | DynamicCtrlPlh | HierarGrid
6/17/2004 10:12:05 AM (W. Europe Standard Time, UTC+01:00)  #  Comments [3] 


 Sunday, May 30, 2004
New HierarGrid version 1.6

The new minor release 1.6 of the HierarGrid contains the following changes:

  • Bugfix: corrected problem with non-unique IDs that were generated for "ChildTemplate" panel in a DataMode=Table HierarGrid
  • Bugfix: child templates were inserted into first column when PagerStyle was set to "Top"
  • Bugfix: resetting the DataItem after inserting the child templates for further custom processing
  • Bugfix: copying selected state for <select> tags

Download here.

With the first bugfix, the FindControl call to access a child template changes to Control c=HierarGrid1.Items[i].Cells[1].FindControl("DCP").FindControl("Panel").FindControl("Panel_[PanelId]").FindControl("ChildTemplate_[PanelId]").FindControl("[InnerControlId]");

HierarGrid
5/30/2004 9:00:33 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, May 03, 2004
Advanced HierarGrid demo application

Nigel Parham was kind enough to create and let me publish a simplified version of his business application that uses the HierarGrid. Included in the app are samples for:

- sorting, filtering
- paging with variable page size and customized style
- row highlighting
- export to Excel
- keyboard support

Please note that due to simplifying the original application, data access code was moved into the code-behind files thus resulting in methods that exceed a screen page. Of course, that should not be considered a best practice :)
Furthermore, as any code on my site it is provided as-is with no warranties, and confers no rights - please consider this as a quick tutorial or proof-of-concept.

The sample app can be downloaded here ("How to get started") and there is also a separate word document that describes installing it.
Thanks Nigel!

HierarGrid
5/3/2004 3:44:26 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Tuesday, March 30, 2004
Article on ASPAlliance about LoadControl vs LoadTemplate

While developing the HierarGrid I noticed that there are some subtle differences between loading UserControls with Page.LoadControl and Page.LoadTemplate. Without digging deeper into that I decided to add a property “TemplateControlMode” to the HierarGrid so that the developer can choose which way to load the template.

After some users asked what the "right" setting for the property is or reported exceptions that were related to choosing the "wrong" setting, I decided to take a look at the two implementations to find the differences. My new article on ASPAlliance explains what I've found.

ASP.NET | HierarGrid
3/30/2004 2:55:27 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Friday, February 20, 2004
News about the HierarGrid

I've found an interesting page on CodeProject that references the HierarGrid: Tony Truong wrote an article about the ExDataGrid, which has the ability to expand and contract datagrid columns rather than datagrid rows as the HierarGrid does. Unfortunately, he decided not to build his own custom control instead of extending the HierarGrid to support both requirements. But it looks like he did a good job anyway.

Furthermore, I got an email from Ariel Dolan who pointed me to his homepage which integrates the HierarGrid with filtering, sorting and paging. Enter "555" into the textbox and hit search. Then click on the "Filter Sort/Hit table" and see the hierarchical grid in action.

Didier Depretz sent me a snapshot of his application which also shows the possibilites of the HierarGrid.

HierarGrid
2/20/2004 6:22:48 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Tuesday, November 04, 2003
Yet another real-life sample of the HierarGrid

Nigel Parham sent me a snapshot of his application that uses the HierarGrid to display nested tables. It looks like he also implemented editing, deleting, filtering, sorting and paging - really amazing!

Thanks Nigel for letting me publish this.

HierarGrid
11/4/2003 3:03:45 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Friday, October 17, 2003
New HierarGrid version 1.5

The new HierarGrid version 1.5 contains the following features and bugfixes:

  • Feature: nested HierarGrids now possibly with more than 3 levels (thanks to Matt Petteys)
  • Bugfix: RowExpanded[x] = false was ignored
  • Bugfix: excluded RowExpanded property from Designer's Property view
  • Bugfix: changed Namespace for internal DynamicControlsPlaceholder to avoid conflicts when using both HierarGrid and DCP in one solution (thanks to Matt Bornstein)

Download here.

HierarGrid
10/17/2003 2:39:39 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Tuesday, September 23, 2003
Another real life sample of the HierarGrid

I've received a snapshot that shows the HierarGrid in action integrated into a Support request application. Looks pretty cool and complex ;)

Thanks to Daniel Rush for sending me this.

HierarGrid
9/23/2003 7:36:23 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, September 22, 2003
HierarGrid: answering some user questions about the hierarchical data grid

Today I have to answer a few user questions regarding the HierarGrid. I decided to share some of the answers in this blog:

  • Steve wants to know how to access controls that are stored in the child template. That's a bit of a hack currently. Maybe I will include a property in a future version of the grid. Until then you can use FindControl to get the reference:
    Control c = HierarGrid1.Items[i].Cells[1].FindControl("DCP").FindControl("Panel").FindControl("Panel_[PanelID]").FindControl("ChildTemplate").FindControl("[InnerControlID]");
    This code can be used inside a loop (where i is the counter).
  • Another Steve asks about cross browser compatibility. I've checked the HierarGrid with Netscape 7.0 and Opera 7.11 and eveything worked except for one problem: the expanded state is not kept between postbacks. Until now I haven't stepped into this problem so I am happy about any hints you have for me.
  • Darin wonders whether he has to put the HierarGrid into the GAC to be able to use it. Definitely not! You can copy the HierarGrid.dll into any directory, start the VS.NET ASP designer, click "Customize Toolbox" and browse for the DLL. VS.NET automatically adds a reference in the current project and copies the DLL into the Bin directory when pressing F5.

That's it for now. Just let me know if you have other questions.

HierarGrid
9/22/2003 1:42:02 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, September 08, 2003
Nested hierarchical grid demo using the HierarGrid 1.4

Most of the feedback emails I recieved during the last two weeks asked for guidance on using HierarGrid.TemplateDataMode=Table. This flag can be used to nest a DataGrid or another HierarGrid inside the child template.

Therefore, I extended the HierarGridDemo by another page called NestHierarGridDemo.aspx that shows how to build 3 layers of grids. You can view and download the demo here (sourcode available in VB.NET and C#).

HierarGrid
9/8/2003 10:38:10 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


New HierarGrid version 1.4

The new HierarGrid version 1.4 contains the following features and bugfixes:

  • Feature: keeps rowstate (expanded/collapsed) between postbacks
  • Feature: property "RowExpanded" to initially expand rows
  • Bugfix: HierarColumn not added to Columns collection
  • Bugfix: Exception with DataViews as DataSource and TemplateDataMode=Table
  • Bugfix: When TemplateDataMode=Table and DataSet.EnforceContraints=true an exception occured
  • Bugfix: Designer declaration corrected

Download here.

HierarGrid
9/8/2003 10:35:14 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Monday, August 25, 2003
HierarGrid feedback and new version 1.3

I wanted to thank everybody for the nice feedback to my HierarGrid article on ASPAlliance.

I've just published a new version 1.3 that includes two minor fixes:

  • a JavaScript error occurred when the ShowHeader attribute was set to false (thanks to Blaž Vrabec)
  • when the TemplateDataMode attribute was set to Table and the Grid was bound to a DataSet instead of a DataTable a cast error occurred in line 319 (thanks to Johannes Rest)

Download here. If you find any other problems please let me know.

HierarGrid
8/25/2003 1:28:28 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 


 Friday, August 15, 2003
Just published first article on ASPAlliance

I've just published my first article on ASPAlliance that talks about how to use the HierarGrid.

It is a tutorial for VB.NET and C# that explains all the steps necessary to use the grid on a webpage:

  1. adding a DataRelation between two DataTables
  2. binding the DataSet to the HierarGrid
  3. creating the UserControls for the child data
  4. wiring up the TemplateSelection event

Additionally, some advanced topics like caching and showing one template for all child elements (e.g. to nest a DataGrid) are covered quickly.

You can find the article here and the source code for the HierarGrid here. Any feedback is more than welcome.

HierarGrid
8/15/2003 4:07:31 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [1] 


 Monday, April 28, 2003
New HierarGrid version supports Netscape

After I have recieved several request for Netscape support, I sat down and tried to modify the JavaScript code. Et voila, the new Version 1.2 has been tested with Netscape 7.0 but should also work with 6.0.

You can download it here: http://www.DenisBauer.com/ASPNETControls.aspx

HierarGrid
4/28/2003 5:23:34 PM (W. Europe Standard Time, UTC+01:00)  #  Comments [0] 



Categories

Search

Blogroll


<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

RSS 2.0 | Atom 1.0 | CDF


Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012, Denis Bauer