﻿<?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 - keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</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>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Thu, 20 Sep 2012 22:35:48 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi Udayan,&lt;/p&gt;&lt;p&gt;Sorry for the late responses. This problem can be solved if we using onkeypress event in some control but WebGrid doesn't have that event. From what I read, onkeypress event doesn't detect esc, ctrl, alt, and shift key. But still we can use OnKeyDown event and I've made work around that might be help you to solve this matter.&lt;/p&gt;
&lt;p&gt;Here's the code:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;function KeyDown(controlId, tblName, rowIndex, cellIndex)
{
    var WebGrid1 = ISGetObject(controlId);
    var key; //parameter to search
    //escape shift key to trigger this event
    if(event.keyCode == 16)
        return false;
    //initial value
    var flag = false;
    key = String.fromCharCode(event.keyCode).toLowerCase();
    if (!(parseInt(event.keyCode) &amp;gt; 64 &amp;amp;&amp;amp; parseInt(event.keyCode) &amp;lt; 91))
    {
        //check if shift key is being pressed or no
        if(event.shiftKey)
        {
            switch(key)
            {
                //you can add the special character here
                case '1':
                    key = "!";
                    break;
                case '2':
                    key = "@";
                    break;
            }
        }
    }
    //search loop
    for (var i = WebGrid1.GetSelectedObject().rowIndex &amp;#43; 1; i &amp;lt; WebGrid1.RootTable.GetRowsCount(); i&amp;#43;&amp;#43;)
    {
        if (key == WebGrid1.RootTable.GetRow(i).GetCell(0).Text.toString().substring(0, 1).toLowerCase())
        {
            WebGrid1.RootTable.GetRow(i).Select();
            flag = true;
            break;
        }
    }
    if (flag == false)
    {
        for (var i = 0; i &amp;lt; WebGrid1.GetSelectedObject().rowIndex; i&amp;#43;&amp;#43;)
        {
            if (key == WebGrid1.RootTable.GetRow(i).GetCell(0).Text.toString().substring(0, 1).toLowerCase())
            {
                WebGrid1.RootTable.GetRow(i).Select();
                flag = true;
                break;
            }
        }
    }
    return true;
}&lt;/pre&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Bernard&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Thu, 20 Sep 2012 10:44:54 GMT</pubDate><dc:creator>UPratap@dow.com</dc:creator><description>&lt;p&gt;Hi Bernard,&lt;/p&gt;
&lt;p&gt;I was able to solve this problem with your help. I appreciate your inputs. The solution fails when the column starts with characters like '%' or '#' Since we are doing it on key-press event, when I hold shift key, this event gets fired.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Please let me know a work-around.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Udayan&lt;/p&gt;</description></item><item><title>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Tue, 04 Sep 2012 21:31:48 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi Udayan,&lt;/p&gt;&lt;p&gt;Unfortunately, there's no property to make sure the rows are checked when you click it. However, you can make validation to check if there's a selected row by using this code&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;if(WebGrid1.GetSelectedObject() != null)&lt;/pre&gt;
&lt;p /&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bernard&lt;/p&gt;</description></item><item><title>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Tue, 04 Sep 2012 16:52:58 GMT</pubDate><dc:creator>UPratap@dow.com</dc:creator><description>&lt;p&gt;Thanks Bernard! This solution is great. I am marking it as the solution.&lt;/p&gt;
&lt;p&gt;But I am struggling with a small issue here. When I am typing say 'a' twice, it checks the first row and then goes to the next row. I donot want to check the row unless I explicitly click and check the row. Is there a property that I need to set to make sure the rows are checked only when I click it?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Please let me know.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Udayan &lt;/p&gt;</description></item><item><title>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Mon, 03 Sep 2012 00:20:34 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi Udayan,&lt;/p&gt;&lt;p&gt;For this problem, I've made my own sample that can be used as workaround for this matter. In my sample, I search the value in onkeydown client side event. I compared the keycode with cell's value of specific column. Then after I found the same value, I just simply select the row. I also attach my sample here. Hope this helps.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bernard&lt;/p&gt;</description></item><item><title>keystroke event in webgrid columns</title><link>http://www.intersoftsolutions.com/Community/WebGrid/keystroke-event-in-webgrid-columns/</link><pubDate>Thu, 30 Aug 2012 01:05:44 GMT</pubDate><dc:creator>UPratap@dow.com</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a webgrid control on my webpage that shows 4 columns. The first column is a RowSelector and the others are simple Text columns. I want to know a way where when users type the characters, the row that starts with the character is highlighted or selected. &lt;/p&gt;
&lt;p&gt;For example : Say my grid has one of the columns that has the name of the employees. Is there a way where when users type 'U', the cursor comes to the row with the employee Name starting with 'U' ? &lt;/p&gt;
&lt;p&gt;This typically happens in a ListBox control, but I was wondering if webgrid supports such events.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Please suggest.&lt;/p&gt;
&lt;p&gt;-Udayan&lt;/p&gt;</description></item></channel></rss>