
Søren Hartig
Top achievements
Rank 2
Søren Hartig
asked on 16 Jan 2009, 02:27 PM
Is there any way that I can access the IsInEditMode from the javascript?
what do I need to do in order this to work?
my javascript looks like this:
what do I need to do in order this to work?
my javascript looks like this:
function UpdateGridOnPostback_LOB_overview(controlId) { |
RowDeselected_LOB_overview(null, null); |
} |
function RowDeselected_LOB_overview(sender, eventArgs) { |
var masterTable = $find('LOB_overview').get_masterTableView(); |
if(masterTable.get_isItemInserted() == true) { |
__doPostBack('LOB_overview$ctl00$ctl02$ctl02$PerformInsertButton',''); |
} |
else { |
var updateItems = false; |
var items = masterTable.get_dataItems(); |
for(i = 0; i < items.length; i++) { |
if(IsInEditMode(items[i])) |
updateItems = true; |
} |
if(updateItems == true) |
masterTable.updateEditedItems(); |
} |
} |
function IsInEditMode(obj) { |
// need to Access isInEditMode here |
return false; |
} |
6 Answers, 1 is accepted
0
Hello Søren,
You can find which items are in edit mode using the _editIndexes array. It contains the indexes of those items.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can find which items are in edit mode using the _editIndexes array. It contains the indexes of those items.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Søren Hartig
Top achievements
Rank 2
answered on 16 Jan 2009, 05:33 PM
I'm new to this :)
any change that you can tell me how to use the _editIndexes array? can't find any information on the website :(
0
Hello Søren,
Please run the following example locally:
aspx:
javascript:
code-behind:
Let me know if you need more information.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please run the following example locally:
aspx:
<input type="button" id="button1" value="Which item is in edit mode?" onclick="checkEditItem()" /> |
<telerik:RadGrid ID="RadGrid1" |
runat="server" |
OnNeedDataSource="RadGrid1_NeedDataSource" |
AutoGenerateEditColumn="true" |
AllowMultiRowEdit="false"> |
</telerik:RadGrid> |
javascript:
function checkEditItem() |
{ |
var radGrid = $find('<%= RadGrid1.ClientID %>'); |
var message = "No item in edit mode"; |
if (radGrid._editIndexes[0]) |
message = "Item " + radGrid._editIndexes[0]; |
alert(message); |
} |
code-behind:
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
RadGrid1.DataSource = new int[] { 0, 1, 2, 3, 4 }; |
} |
Let me know if you need more information.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Søren Hartig
Top achievements
Rank 2
answered on 20 Jan 2009, 09:35 AM
Hi Daniel,
I'm getting errors running your example:
default.aspx
default.aspx.cs
Telerik.Web.UI.dll is version: 2008.3 1314
Error:
I'm just trying to get this to work :)
I'm getting errors running your example:
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
<script type="text/javascript"> |
function checkEditItem() { |
var radGrid = $find('<%= RadGrid1.ClientID %>'); |
var message = "No item in edit mode"; |
if (radGrid._editIndexes[0]) |
message = "Item " + radGrid._editIndexes[0]; |
alert(message); |
} |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<input type="button" id="button1" value="Which item is in edit mode?" onclick="checkEditItem()" /> |
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" |
AutoGenerateEditColumn="true" AllowMultiRowEdit="false"> |
</telerik:RadGrid> |
</div> |
</form> |
</body> |
</html> |
default.aspx.cs
using System; |
using System.Collections.Generic; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using Telerik.WebControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
RadGrid1.DataSource = new int[] { 0, 1, 2, 3, 4 }; |
} |
} |
Telerik.Web.UI.dll is version: 2008.3 1314
Error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). |
Source Error: |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace: |
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] |
System.Web.UI.ControlCollection.Add(Control child) +8674071 |
Telerik.RadGridUtils.RadControl.RegisterCssFile(String path) +264 |
Telerik.RadGridUtils.RadControl.RenderRuntimeSkin() +133 |
Telerik.RadGridUtils.RadControl.Page_PreRenderComplete(Object sender, EventArgs e) +34 |
System.EventHandler.Invoke(Object sender, EventArgs e) +0 |
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029 |
-------------------------------------------------------------------------------- |
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 |
I'm just trying to get this to work :)
0

Bruno
Top achievements
Rank 2
answered on 20 Jan 2009, 11:27 AM
Hi Daniel,
this is me, I was using my employer account because the product was bought using his account.
I still don't get how this work.
the biggest problem is that the help on documentation does not give me the help I need, like how does it work instead of having just a description.
for example:
there is no documentation on this, and I needed to understand what's the index? is that the row index? what kind of object does that apply to? what is the returns, how can I get that object gives me the rows in edit mode only? and thinks like that.
I'm new to Telerik, but I find the online documentation hard to follow when there is no examples or related articles to the item we are seeing. As an example, MSDN has some functions/methods that are related to that method we are seeing and we could just say "Ahhh, why doing this, this way, while I can use that method instead" kind'a thing.
Thank you for the help.
this is me, I was using my employer account because the product was bought using his account.
I still don't get how this work.
the biggest problem is that the help on documentation does not give me the help I need, like how does it work instead of having just a description.
for example:
there is no documentation on this, and I needed to understand what's the index? is that the row index? what kind of object does that apply to? what is the returns, how can I get that object gives me the rows in edit mode only? and thinks like that.
I'm new to Telerik, but I find the online documentation hard to follow when there is no examples or related articles to the item we are seeing. As an example, MSDN has some functions/methods that are related to that method we are seeing and we could just say "Ahhh, why doing this, this way, while I can use that method instead" kind'a thing.
Thank you for the help.
0
Hello Bruno,
Thank you for your feedback about our documentation. Currently there is no article related to _editIndexes.
Regarding the error you described - please either try to wrap the javascript code in RadCodeBlock or move your code into the body.
You can find more information concerning this error in the following article:
ASP.NET AJAX Framework
Additionally I recommend you examine our new support blog post if you need some directions about finding the needed help resources.
New support resources search facilities on telerik.com
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for your feedback about our documentation. Currently there is no article related to _editIndexes.
Regarding the error you described - please either try to wrap the javascript code in RadCodeBlock or move your code into the body.
You can find more information concerning this error in the following article:
ASP.NET AJAX Framework
Additionally I recommend you examine our new support blog post if you need some directions about finding the needed help resources.
New support resources search facilities on telerik.com
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.