
Purushottam Somani
Top achievements
Rank 2
Purushottam Somani
asked on 09 Sep 2010, 12:46 PM
I am trying edit on double click in Grid, but getting javascript error "Expected }". I am implementing this feature from this page
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
I have tried data binding using SqlDataSource and manually created dataset using data table on seperate pages.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
I have tried data binding using SqlDataSource and manually created dataset using data table on seperate pages.
4 Answers, 1 is accepted
0
Hi Purushottam,
I am afraid that the provided information is not enough to determine what could be the reason for this issue. Could you please post your aspx markup code. Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.
All the best,
Pavlina
the Telerik team
I am afraid that the provided information is not enough to determine what could be the reason for this issue. Could you please post your aspx markup code. Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.
All the best,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Purushottam Somani
Top achievements
Rank 2
answered on 10 Sep 2010, 05:18 AM
this is aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DblClickUpdate.aspx.cs" Inherits="DblClickUpdate" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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>Test Page</title>
<script type="text/javascript">
<!--
var hasChanges, inputs, dropdowns, editedRow;
function RowClick(sender, eventArgs)
{
if(editedRow && hasChanges)
{
hasChanges = false;
if(confirm("Update changes?"))
{
$find("<%# RadGrid1.MasterTableView.ClientID %>").updateItem(editedRow);
}
}
}
function RowDblClick(sender, eventArgs)
{
editedRow = eventArgs.get_itemIndexHierarchical();
$find("<%# RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);
}
function GridCommand(sender, args)
{
if (args.get_commandName() != "Edit")
{
editedRow = null;
}
}
function GridCreated(sender, eventArgs)
{
alert('hi');
var gridElement = sender.get_element();
var elementsToUse = [];
inputs = gridElement.getElementsByTagName("input");
for (var i = 0; i < inputs.length;i++)
{
var lowerType = inputs[i].type.toLowerCase();
if(lowerType == "hidden" || lowerType == "button")
{
continue;
}
Array.add(elementsToUse, inputs[i]);
inputs[i].onchange = TrackChanges;
}
dropdowns = gridElement.getElementsByTagName("select");
for (var i = 0; i < dropdowns.length;i++)
{
dropdowns[i].onchange = TrackChanges;
}
setTimeout(function(){if(elementsToUse[0])elementsToUse[0].focus();},100);
}
function TrackChanges(e)
{
hasChanges = true;
}
-->
</script>
</head>
<body>
<form runat="server" id="mainForm" method="post">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<!-- content start -->
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
<telerik:AjaxUpdatedControl ControlID="Label1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid1" Width="97%" EnableAjaxSkinRendering="true" ShowStatusBar="True"
AllowSorting="True" PageSize="7" GridLines="None" AllowPaging="True" runat="server"
AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" AutoGenerateColumns="false"
OnDataBound="RadGrid1_DataBound">
<MasterTableView EditMode="InPlace" Width="100%">
<Columns>
<telerik:GridBoundColumn UniqueName="Name" DataField="Name" HeaderText="Name" HeaderStyle-Width="25%"
ColumnEditorID="GridTextBoxColumnEditor1" />
<telerik:GridBoundColumn UniqueName="Class" DataField="Class" HeaderText="Class"
HeaderStyle-Width="20%" />
<telerik:GridNumericColumn UniqueName="Salary" DataField="Salary" HeaderText="Salary"
DataFormatString="{0:C}" HeaderStyle-Width="10%" ColumnEditorID="GridNumericColumnEditor1" />
</Columns>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" OnGridCreated="GridCreated"
OnCommand="GridCommand" />
</ClientSettings>
</telerik:RadGrid>
<telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="180px" />
<br />
<asp:Label ID="Label1" runat="server" EnableViewState="false" />
<br />
<asp:SqlDataSource ID="SessionDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connTest %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT Name, Class, Salary FROM [Person]"
UpdateCommand="UPDATE [Person] SET [Name] = @Name, [Class] = @Class, [Salary] = @Salary WHERE [Name] = @original_Name"
OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Class" Type="String" />
<asp:Parameter Name="Salary" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
<!-- content end -->
</form>
</body>
</html>
0
Hello Purushottam,
I have followed your scenario and prepared a sample project that is working as expected.Please give it a try and let me know if it helps to avoid this error.
Greetings,
Pavlina
the Telerik team
I have followed your scenario and prepared a sample project that is working as expected.Please give it a try and let me know if it helps to avoid this error.
Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Purushottam Somani
Top achievements
Rank 2
answered on 13 Sep 2010, 05:49 AM
Hi Pavlina,
It works, but has some issues. Thanks for support. On double click field appears in editable format, but when click on other row it does not update.
I think you have not provided update command in this code.
Thanks
It works, but has some issues. Thanks for support. On double click field appears in editable format, but when click on other row it does not update.
I think you have not provided update command in this code.
Thanks