﻿<?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 - WebCombo - Clearing Row Selection from Client Side</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Clearing-Row-Selection-from-Client-Side/</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>Clearing Row Selection from Client Side</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Clearing-Row-Selection-from-Client-Side/</link><pubDate>Wed, 28 Apr 2010 00:20:12 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><category>Clear selection from Client Side</category><description>&lt;p&gt;&lt;font class="Apple-style-span" style="font-size: 15px; "&gt;&lt;span class="Apple-style-span" style="font-size: 12px; " /&gt;&lt;/font&gt;&lt;/p&gt;&lt;font class="Apple-style-span" style="font-size: 15px; "&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-size: 9pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt; Hi Dhaval,&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;&lt;o:p /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-size: 9pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;      I have tried my colleague snippet and it
works just fine. Actually, you do not need to attach those ClearSelection()
function into any client side event. From previous post, you have mentioned
that you wanted "client side on click of a button say 'Clear
Selection'". So, you can kindly try to use a regular HTML button that
trigger this function. It should work nicely.&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;&lt;o:p /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-size: 9pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;      I hope it helps. Thank you and have a
nice day.&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;&lt;o:p /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-size: 9pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;Best Regards,&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;&lt;o:p /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-size: 9pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;Andi Santoso&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'lucida sans unicode', sans-serif; color: black; "&gt;&lt;o:p /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p /&gt;</description></item><item><title>Clearing Row Selection from Client Side</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Clearing-Row-Selection-from-Client-Side/</link><pubDate>Tue, 27 Apr 2010 12:57:27 GMT</pubDate><dc:creator>dhavalv</dc:creator><category>Clear selection from Client Side</category><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I am trying the code to clear the row selection stated above. Can you please tell me in which client side event should I be adding this code. I tried to call the above function "ClearSelection()" during "OnAfterResponseProcess" event, which clears the selection, but it reappears after the page finishes loading. When I put an alert in the end of the "ClearSelection()" method, the selection is cleared, but as soon as the page finishes loading it appears back. &lt;/p&gt;
&lt;p&gt;FYI: I am using "&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;RestoreRowSelection = "ALL" &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;Thanks and appreciate your help&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;Regards&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;Dhaval.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;</description></item><item><title>Clearing Row Selection from Client Side</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Clearing-Row-Selection-from-Client-Side/</link><pubDate>Tue, 27 Apr 2010 11:23:39 GMT</pubDate><dc:creator>Glayaar</dc:creator><category>Clear selection from Client Side</category><description>&lt;p&gt;Regarding the selected rows count, you could use the SelectedRows property in the multiple selection WebGrid. However, it will also exhibit the same issue as you described. A workaround will be to filter the unique key value of each selected row so we will only count the unique key value. Here is the snippet:&lt;/p&gt;&lt;pre&gt;for(var i = 0; i &amp;lt; grid.RootTable.SelectedRows.length; i&amp;#43;&amp;#43;)&lt;br /&gt;{&lt;br /&gt;    var keyVal = grid.RootTable.SelectedRows[i].getAttribute('keyValue');&lt;br /&gt;    &lt;br /&gt;    if(strKeyList.indexOf(keyVal &amp;#43; ";") &amp;lt; 0)&lt;br /&gt;        strKeyList &amp;#43;= grid.RootTable.SelectedRows[i].getAttribute('keyValue') &amp;#43; ";"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var strKeyArr = strKeyList.split(";");&lt;br /&gt;alert(strKeyArr.length - 1);&lt;/pre&gt;&lt;p&gt;In order to clear selection in a WebGrid with classic paging, you will need to use the ClearSelection method and SelectedRows.Clear from WebGrid table Storage property. In your case, for multiple selection you will need to reselect one of the selected row before invoking ClearSelection so all the selected row will be cleared. Here is the snippet:&lt;/p&gt;&lt;pre&gt;function ClearSelection()&lt;br /&gt;{&lt;br /&gt;    var grid = ISGetObject("wgTest");&lt;br /&gt;&lt;br /&gt;    var strKeyList = "";&lt;br /&gt;&lt;br /&gt;    for (var i = 0; i &amp;lt; grid.RootTable.SelectedRows.length; i&amp;#43;&amp;#43;)&lt;br /&gt;    {&lt;br /&gt;        var keyVal = grid.RootTable.SelectedRows[i].getAttribute('keyValue');&lt;br /&gt;&lt;br /&gt;        if (strKeyList.indexOf(keyVal &amp;#43; ";") &amp;lt; 0)&lt;br /&gt;            strKeyList &amp;#43;= grid.RootTable.SelectedRows[i].getAttribute('keyValue') &amp;#43; ";"&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    var strKeyArr = strKeyList.split(";");&lt;br /&gt;    &lt;br /&gt;    var rowKeyObj = new Array();&lt;br /&gt;&lt;br /&gt;    for (var j = 0; j &amp;lt; strKeyArr.length - 1; j&amp;#43;&amp;#43;)&lt;br /&gt;    {&lt;br /&gt;        var currRowObj = grid.RootTable.GetRowByKeyValue(strKeyArr[j]);&lt;br /&gt;        if (currRowObj)&lt;br /&gt;        {&lt;br /&gt;            rowKeyObj.push(currRowObj);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    if (rowKeyObj.length &amp;gt; 0)&lt;br /&gt;    {&lt;br /&gt;        rowKeyObj[0].Select();&lt;br /&gt;        grid.ClearSelection();&lt;br /&gt;&lt;br /&gt;        for (var k = 0; k &amp;lt; rowKeyObj.length; k&amp;#43;&amp;#43;)&lt;br /&gt;        {&lt;br /&gt;            rowKeyObj[k].Uncheck();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    grid.RootTable.Storage.SelectedRows.Clear();&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Clearing Row Selection from Client Side</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Clearing-Row-Selection-from-Client-Side/</link><pubDate>Mon, 26 Apr 2010 13:33:35 GMT</pubDate><dc:creator>dhavalv</dc:creator><category>Clear selection from Client Side</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am using WebGrid Version 7 with latest hotfix. I have enabled &lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;AllowMultipleSelection&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;="Yes" and have &lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;RestoreRowSelection = "All" and PersistRowChecker="False".&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;I want to find out a way by which I can clear the multiple selection of rows across pages, including the selected styling from the client side on click of a button say "Clear Selection". &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000"&gt;Also, on the client side I am using the method &lt;span style="font-size: 13px"&gt;"grid.RootTable.GetCheckedRows().length" to return me a count of the checked rows on the client side. But, this method does not return me a correct count. For e.g - When I select 4 rows in page 1, navigate to page 2 and select further 2 rows holding the ctrl key, then navigate back to page 1. Then instead of showing the count as 6 rows, it shows me count as 10 rows. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000"&gt;&lt;span style="font-size: 13px"&gt;I guess it adds the selection in page 1 to its existing count, irrespective of me making any further selections to that page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000"&gt;&lt;span style="font-size: 13px"&gt;Thanks and appreciate your help.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000"&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #0000ff; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt;&lt;span style="color: #ff0000; font-size: 13px"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>