﻿<?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 - Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</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>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 12:23:15 GMT</pubDate><dc:creator>Michael</dc:creator><description>&lt;p&gt;Great&lt;/p&gt;
&lt;p&gt;Thanks James!&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 11:52:33 GMT</pubDate><dc:creator>james</dc:creator><description>&lt;p&gt;Michael,&lt;/p&gt;&lt;p&gt;Yes, Refresh is an asynchronous AJAX process. But you can also run it synchronously by simply setting the Asynchronous property to false.&lt;/p&gt;
&lt;p&gt;Here's how:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre&gt;grid.XmlHttp.&lt;b&gt;Asynchronous&lt;/b&gt; = &lt;i&gt;false&lt;/i&gt;;&lt;/pre&gt;
&lt;p&gt;Remember to set it to true again after your Refresh() method call.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;br /&gt;James.&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 10:57:56 GMT</pubDate><dc:creator>Michael</dc:creator><description>&lt;p&gt;Hi James&lt;/p&gt;
&lt;p&gt;I want refresh date before I check Dependencies. I have add &lt;strong&gt;grd.Refresh()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now I get sometimes following Message: &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Please wait while WebGrid is in progress processing request...&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Is refresh performed asynchronously? Is there a way to refresh data first?&lt;/p&gt;&lt;pre&gt;function grd_OnAcceptAllChanges(controlId) {

    var grd = ISGetObject(controlId);
    grd.Refresh();

    var DelChanges = grd.GetChanges("Deleted");
    for (var i in DelChanges) {
        if (DelChanges[i].Row.GetCell("Dependencies").Value != "0") {
            DelChanges[i].Row.UndoChanges();
            alert("Row can't be deleted: " &amp;#43; DelChanges[i].Row.GetCell("Name").Value);
        }
    }
    return true;
} &lt;/pre&gt;
</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 06:32:27 GMT</pubDate><dc:creator>james</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;Now, I use ClientSideEvent OnAcceptAllChanges. Perhaps, somebody knows a better way&lt;/p&gt;&lt;pre&gt;function grd_OnAcceptAllChanges(controlId){
    var grd = ISGetObject(controlId);
    var DelChanges = grd.GetChanges("Deleted");
    
    for (var i in DelChanges)
    {
        if (DelChanges[i].Row.GetCell("Dependencies").Value != "0") {
            DelChanges[i].Row.UndoChanges();
        }                 
    }
    return true;
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Michael,&lt;/p&gt;
&lt;p&gt;I think your code is already good and decent. That should be the best way to achieve your scenario.&lt;/p&gt;
&lt;p&gt;- James.&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 05:48:06 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;If you can get cells information of a row object, would it be a help for your scenario?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;e.g. &lt;span style="font-family: 'courier new'; font-size: 12px; white-space: pre; "&gt;rowObject.GetCells()[i];&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You can get the value of each cells and also keyValue in each rowObject.  Hope this helps. &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 05:40:50 GMT</pubDate><dc:creator>Michael</dc:creator><description>&lt;p&gt;The user should not be able to delete some rows.&lt;/p&gt;
&lt;p&gt;I will check this before the data is sent to the database. Has User deleted a row which has Dependencies (e.g. foreign key constraint), I will undo changes (for this row only).&lt;/p&gt;
&lt;p&gt;With ClientSideEvent "OnBeforeDelete" I could inform User by realtime. But this Event is not fired in Batch Update mode. Therefore, I inform the user on OnAcceptAllChanges Event.&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 03:41:02 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;What exactly do you want to achieve? If you want to UndoChanges, you can also validate at &lt;i&gt;&lt;b&gt;OnUndoChanges&lt;/b&gt;&lt;span style="font-style: normal; "&gt; event. There should be a parameter, &lt;/span&gt;&lt;b&gt;rowObject&lt;/b&gt;&lt;span style="font-style: normal; "&gt;. &lt;br /&gt;rowObject has a properties, &lt;/span&gt;&lt;b&gt;_RowStateCached&lt;/b&gt;&lt;span style="font-style: normal; "&gt; which will able you to know if its state deleted, modified or etc. Hope this helps.&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Wed, 09 Sep 2009 02:08:14 GMT</pubDate><dc:creator>Michael</dc:creator><description>&lt;p&gt;Now, I use ClientSideEvent OnAcceptAllChanges. Perhaps, somebody knows a better way&lt;/p&gt;&lt;pre&gt;function grd_OnAcceptAllChanges(controlId)
{
    var grd = ISGetObject(controlId);

    var DelChanges = grd.GetChanges("Deleted");
    
    for (var i in DelChanges)
    {
        if (DelChanges[i].Row.GetCell("Dependencies").Value != "0") {
            DelChanges[i].Row.UndoChanges();
        }                 
    }
    return true;
}&lt;/pre&gt;
</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Tue, 08 Sep 2009 22:49:22 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;As James has said, those events will be fired only in normal updating mode, not for BatchUpdate scenario. I am sure that the information from James has already answered your question. &lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Tue, 08 Sep 2009 12:20:19 GMT</pubDate><dc:creator>james</dc:creator><description>&lt;p&gt;Michael,&lt;/p&gt;&lt;p&gt;It appears that the OnBeforeXXX and OnAfterXXX for editing-type operations will be fired only in normal updating mode (non batch updating).&lt;/p&gt;
&lt;p&gt;I think the reason is because batch update has its own specific events such as &lt;b&gt;OnAcceptAllChanges&lt;/b&gt;, &lt;b&gt;OnAddPendingChanges&lt;/b&gt;, &lt;b&gt;OnUndoChanges&lt;/b&gt; and &lt;b&gt;OnUndoAllChanges&lt;/b&gt; which supercede the basic editing events.&lt;/p&gt;
&lt;p&gt;Hope this helps, &lt;br /&gt;James.&lt;/p&gt;</description></item><item><title>Some ClientSideEvents are not fired</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Some-ClientSideEvents-are-not-fired/</link><pubDate>Tue, 08 Sep 2009 11:33:41 GMT</pubDate><dc:creator>Michael</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Please have a look on follow Code sequence.&lt;/p&gt;
&lt;p&gt;ClientSideEvent &lt;em&gt;&lt;span style="color: #548dd4"&gt;grd_OnBeforeDelete&lt;/span&gt;&lt;/em&gt;, &lt;span style="color: #c6d9f0"&gt;&lt;em&gt;&lt;span style="color: #548dd4"&gt;grd_OnBeforeAdd&lt;/span&gt;&lt;/em&gt; &lt;/span&gt;and &lt;span style="color: #548dd4"&gt;&lt;em&gt;grd_OnAfterDelete&lt;/em&gt; &lt;/span&gt;are not fired!&lt;/p&gt;
&lt;p&gt;ClientSideEvent &lt;span style="color: #548dd4"&gt;&lt;em&gt;grd_OnBeforeRowSelect&lt;/em&gt;&lt;/span&gt;, &lt;span style="color: #548dd4"&gt;&lt;em&gt;grd_OnCellDblClick&lt;/em&gt; &lt;/span&gt;works fine!&lt;/p&gt;
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;AllowAddNew and AllowDelete are set to Yes on ServerSideEvent grd_InitializeLayout.&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Page Title="" Language="C#" MasterPageFile="~/Relays/Masterdata/MasterData.master" AutoEventWireup="true" CodeBehind="Errorlist.aspx.cs" Inherits="QS_Client.Relays.Masterdata.Errorlist" %&amp;gt;
&amp;lt;%@ Register assembly="ISNet.WebUI.WebDesktop" namespace="ISNet.WebUI.WebDesktop" tagprefix="ISWebDesktop" %&amp;gt;
&amp;lt;%@ Register assembly="ISNet.WebUI.WebGrid" namespace="ISNet.WebUI.WebGrid" tagprefix="ISWebGrid" %&amp;gt;

&amp;lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&amp;gt;

    &amp;lt;script language="javascript" type="text/javascript" id="grd_OnBeforeDelete"&amp;gt;
		&amp;lt;!--
		function grd_OnBeforeDelete(controlId, tblName, rowObject)
		{
		    var grd = ISGetObject(controlId);
		    alert("grd_OnBeforeDelete");

			return true;			
		}
		--&amp;gt;
&amp;lt;/script&amp;gt;

    &amp;lt;script language="javascript" type="text/javascript" id="grd_OnBeforeRowSelect"&amp;gt;
		&amp;lt;!--
		function grd_OnBeforeRowSelect(controlId, tblName, lastSelectedObject)
		{
		    var grd = ISGetObject(controlId);
		    alert("grd_OnBeforeRowSelect");
			
			return true;
		}
		--&amp;gt;
&amp;lt;/script&amp;gt;

    &amp;lt;script language="javascript" type="text/javascript" id="grd_OnBeforeAdd"&amp;gt;
		&amp;lt;!--
		function grd_OnBeforeAdd(controlId, tblName, rowObject)
		{
		    var grd = ISGetObject(controlId);
		    alert("grd_OnBeforeAdd");
			
			return true;
		}
		--&amp;gt;
&amp;lt;/script&amp;gt;

    &amp;lt;script language="javascript" type="text/javascript" id="grd_OnAfterDelete"&amp;gt;
		&amp;lt;!--
		function grd_OnAfterDelete(controlId, tblName, rowObject, xmlResponseObject)
		{
		    var grd = ISGetObject(controlId);
		    alert("grd_OnAfterDelete");
			
			return true;
		}
		--&amp;gt;
&amp;lt;/script&amp;gt;

    &amp;lt;script language="javascript" type="text/javascript" id="grd_OnCellDblClick"&amp;gt;
		&amp;lt;!--
		function grd_OnCellDblClick(controlId, tblName, rowIndex, cellIndex, cellEl)
		{
			var grd = ISGetObject(controlId);
			alert("grd_OnCellDblClick");
			return true;
		}
		--&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;/asp:Content&amp;gt;
&amp;lt;asp:Content ID="Content2" ContentPlaceHolderID="cphMasterdata" runat="server"&amp;gt;
    &amp;lt;ISWebGrid:WebGrid ID="grd" runat="server" Height="250px" 
        oninitializelayout="grd_InitializeLayout" UseDefaultStyle="True" Width="500px" 
        oninitializedatasource="grd_InitializeDataSource" 
        oninitializerow="grd_InitializeRow" 
        onpreparedatabinding="grd_PrepareDataBinding" 
        onbatchupdate="grd_BatchUpdate"&amp;gt;
        &amp;lt;LayoutSettings&amp;gt;
            &amp;lt;ClientSideEvents OnBeforeDelete="grd_OnBeforeDelete" 
                OnBeforeRowSelect="grd_OnBeforeRowSelect" OnBeforeAdd="grd_OnBeforeAdd" 
                OnAfterDelete="grd_OnAfterDelete" OnCellDblClick="grd_OnCellDblClick" /&amp;gt;
        &amp;lt;/LayoutSettings&amp;gt;
    &amp;lt;/ISWebGrid:WebGrid&amp;gt;
&amp;lt;/asp:Content&amp;gt;&lt;/pre&gt;
</description></item></channel></rss>