﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Tue, 19 Oct 2010 15:56:09 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hello Eric,&lt;/p&gt;&lt;p&gt;This issue is being investigated by our developer teams. I will let you know when I received response from them.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Mon, 18 Oct 2010 05:33:29 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;Hi Handy,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;Back from my vacation, I read your response above. Your above code was about the problem why storing the values in the Session object might have failed. Correct?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;Actually I'm not using the Session object anymore. As mentioned, I'm storing the expand/collapse status in a form field on the page. Please also see my attached sample, version 3. This is the final, working solution for me.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;The only remaining problem, as mentioned in my last post, is why I have to initialize the Session object (line 20 in Default.aspx.vb). I assume a bug in WebGrid. Can you check that?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;Regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 15px"&gt;&lt;span style="font-family: times new roman"&gt;Eric&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Fri, 01 Oct 2010 17:06:19 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hello Eric,&lt;/p&gt;&lt;p&gt;I found that the validation below cause your expand/collapse status issue.&lt;br /&gt;&lt;font class="Apple-style-span" style="font-size: 15px; font-family: 'courier new', tahoma; "&gt;&lt;span style="font-size: 12px; white-space: pre; "&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;font class="Apple-style-span" style="font-size: 15px; font-family: 'courier new', tahoma; "&gt;&lt;pre&gt;If Not grdResult.IsFlyPostBack AndAlso Session(_SessionState_Expanded_WebGridRows) IsNot Nothing Then
&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'lucida sans unicode'; white-space: normal; font-size: 13px; "&gt;If I only use the condition with below code, your expand/collapse works well.&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p /&gt;
&lt;p /&gt;&lt;pre&gt;If Session(_SessionState_Expanded_WebGridRows) IsNot Nothing Then
&lt;/pre&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p /&gt;
&lt;p /&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Fri, 01 Oct 2010 08:37:11 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hi Handy,&lt;/p&gt;&lt;p&gt;Ok, after working on this for weeks now, I found the final solution. Manually caching the expand/collapse status now works.&lt;/p&gt;
&lt;p&gt;What I have done:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;In ClientSideEvents I defined handlers for OnSelfRefRowExpand and OnSelfRefCollapse&lt;/li&gt;&lt;li&gt;added a hidden form field to store the expand/collapse status&lt;/li&gt;&lt;li&gt;In these JavaScript handlers get grid.GetSelectedObject().GetRowObject() to access the row and wgGetCellByName(row.GetElement(),'colname'); to get the cell, and cell.ID to access the CustomAttributes, which store the row-ID. For expand, add the ID into the hidden field, for collapse remove it from there (comma separated string with IDs).&lt;/li&gt;&lt;li&gt;In grid's InitializeRow event handler, read this hidden form field and if the current row's ID is contained in the stored form field value, then call e.Row.ExpandSelfRefRow(True) to restore the expand status.&lt;/li&gt;&lt;/ul&gt;Ok, so this solved the remaining problem with storing the expand/collaps status.&lt;br /&gt;&lt;br /&gt;What you could do is to check why the Session object has to get initialized before WebGrid is usable. (My first post with the first sample.)&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Eric&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Thu, 30 Sep 2010 18:07:26 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hello Eric,&lt;/p&gt;&lt;p&gt;Ok, but please give me a little time to figure out your sample because your code is too complex.&lt;br /&gt;The properties won't work because you were using SelfReference scenario.&lt;br /&gt;The properties only works for Hierarchical scenario.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Thu, 30 Sep 2010 09:17:43 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>Hi Handy,&lt;p&gt;I think the problem is that in FlyPostBack (InitializePostBack event), where I handle the button press, I use grid.ClientAction.Refresh to refresh the grid data after the merge button was pressed.&lt;/p&gt;
&lt;p&gt;Because of this data (grid) refresh, the property RestoreExpandedChildRows probably has no effect, because this works only for normal FlyPostBack events like resorting etc.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Can you look at the sample again and tell me what to fix there so that it works? I tried to cache the expanded nodes like it was necessary before the property RestoreExpandedChildRow existed, but it doesn't work.&lt;/p&gt;
&lt;p&gt;It would be great if you could fix the demo I created for you.&lt;br /&gt; &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Eric&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Thu, 30 Sep 2010 04:33:37 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hi Handy,&lt;/p&gt;&lt;p&gt;Thanks for your helpful answer. First I searched for this property, but both Google and your site returned zero results. Then I assumed there was a typo. I also thought that WebGrid 6 doesn't support this feature. But I remember that we upgraded to WebGrid 6 not so long ago, so maybe this was valid only for WebGrid 5. Anyway, I found the property in the meantime. It is called RestoreExpandedChildRows and is located on the LayoutSettings tag.&lt;/p&gt;
&lt;p&gt;I have set this to true and removed all other previous code to expand / collaps by JavaScript. Unfortunately  it is still not working. Are you sure this should work with WebGrid version 6?&lt;/p&gt;
&lt;p&gt;Can you modify my last sample so that it works? With this property or by any other means.&lt;/p&gt;
&lt;p&gt;And yes, this is the main problem remaining.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Eric&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Wed, 29 Sep 2010 15:28:41 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hello Eric,&lt;/p&gt;&lt;p&gt;I am not sure why the status in session is not working. I am still investigating this issue. &lt;br /&gt;However, if you want only to remember the state of expand/collapse, does this mean that It would remember if the state and persists expand/collapse when refreshed or merged?&lt;br /&gt;If yes, why don't you try &lt;b&gt;&lt;i&gt;RestoreExpandChildRows&lt;/i&gt;&lt;/b&gt; properties? After this properties is set as true, try to expand/collapse a row then refresh WebGrid. You can see that it still persists expand/collapse state.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy &lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Wed, 29 Sep 2010 03:25:56 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hi Handy,&lt;/p&gt;&lt;p&gt;Ok, no partial refreshes possible.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;And what about my remaining questions?&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;When clicking on Merge or Unmerge, the hierarchical tree 
collapses. I tried to save all expand/collapse status in the Session, 
like I've done this on other places already, but it's not working.&lt;/strong&gt; 
Current demo source included (in earlier post).&lt;/li&gt;&lt;li&gt;Expand/collapse 
status should not go into Session at all, because users might have 
several browsers open with the same application in it. But first goal is
 to get this working at all.&lt;/li&gt;&lt;li&gt;Verify 
that this design is correct.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Most important is now getting the expand/collapse to work (remain as 
it is when clicking merge/unmerge).&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Eric&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Tue, 28 Sep 2010 15:20:11 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hello Eric,&lt;/p&gt;&lt;p&gt;It seems your scenario could not be done.&lt;br /&gt;If you want to only refresh a child after merge ( changes only in a child), then It could not be done.&lt;br /&gt;WebGrid could not refresh partially only for a child. It should refresh all.&lt;br /&gt;This is a default behaviour. Our WebGrid still hasn't supported refresh only in child level yet.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Design question: How to add OnClick Handler on a field in WebGrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Design-question-How-to-add-OnClick-Handler-on-a-field-in-WebGrid/</link><pubDate>Tue, 07 Sep 2010 10:50:13 GMT</pubDate><dc:creator>Eric</dc:creator><category>WebGrid</category><category>Image</category><category>onclick</category><category>click handler</category><description>&lt;p&gt;Hi! I'm creating a new page with the following details:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;using WebGrid 6.0.7200.220, clients are all IE6&lt;/li&gt;&lt;li&gt;hierarchical (all rows have a id and parent_id),&amp;nbsp;lower nodes are loaded on demand&lt;/li&gt;&lt;li&gt;Special feature: second column that shows an image (&amp;#43; or - in a square) to merge all subnodes.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;When clicking on this special image, the data of all nodes below the selected row-node are being merged and no folders are shown anymore, only the leaf rows (like files) that are below the selected node (anywhere below). Clicking again should undo everything and return to the folder view.&lt;/p&gt;
&lt;p&gt;In &lt;span style="font-size: 13px"&gt;InitializeSelfReferenceDataSource I am loading the data below the current node and merging the data into the grid by calling dt.Merge (dt is the DataTable from e.DataSource).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 13px"&gt;My question would be on how to implement this special feature. When the user clicks on the image I think I should just delete all data below the current node from the RootTable of the grid, then get all data below the current node and merge it into the RootTable.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 13px"&gt;Now my question is how to implement the onclick event on the image. The image is being added simply by in InitializeRow using e.Row.Cells.GetNamedItem and setting cell.Image="plus.gif". But how do I put a onclick handler on that?&amp;nbsp;And what should it do to refresh the data (requires postback to go to the server somehow).&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>