iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello, i have a WebGrid with some rows filled, when i doubleclick to a specific cell it will call the function "WebGrid1_OnCellDblClick" and sets the current DateTime in the Cell. after i press shift and Enter it won't save the changes in die DB. It doesn't recognize the entry as an Update. When I edit a cell by myself it work. Do you have any solutions?
here is my code:
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="518px" UseDefaultStyle="True" Width="1219px" DataMember="DefaultView" DataSourceID="SqlDataSource1"> <RootTable DataKeyField="ID"> <Columns> <ISWebGrid:WebGridColumn Caption="ID" DataMember="ID" DataType="System.Decimal" Name="ID" Width="100px" Visible="False"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Ankunft" DataMember="ANKUNFT" DataType="System.DateTime" Name="ANKUNFT" Width="150px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Abreise" DataMember="ABREISE" DataType="System.DateTime" Name="ABREISE" Width="150px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Status" Name="STATUS" Width="100px" DataMember="STATUS" DataType="System.Decimal"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> <LayoutSettings AllowAddNew="Yes" AllowDelete="Yes" AllowEdit="Yes" AllowFilter="Yes" AllowSorting="Yes"> <ClientSideEvents OnCellDblClick="WebGrid1_OnCellDblClick" /> </LayoutSettings> </ISWebGrid:WebGrid>
function WebGrid1_OnCellDblClick(controlId, tblName, rowIndex, cellIndex, cellEl) { var grid = ISGetObject(controlId); var WebCombo2 = ISGetObject("WebCombo2"); var now = new Date(); var datum = (pad(now.getDate())).toString() + "." + (pad(1 + now.getMonth())).toString() + "." + now.getFullYear().toString() + " " + (pad(now.getHours())).toString() + ":" + (pad(now.getMinutes())).toString() + ":00"; if (cellIndex == 17) { grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetValue(now, true); grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetText(datum.toString() ); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetValue('0', true); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetText('Awensend'); } if (cellIndex == 18) { grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetValue(now, true); grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetText(datum.toString()); } return true; }
if (cellIndex == 17){ grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetValue(now, true); grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetText(datum.toString()); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetValue('0', true); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetText('Awensend'); } if (cellIndex == 18) { grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetValue(now, true); grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetText(datum.toString()); }
To:
if (cellIndex == 17) { grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetValue(now); grid.GetSelectedObject().ToRowObject().GetCell('ANKUNFT').SetText(datum.toString(), true); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetValue('0'); grid.GetSelectedObject().ToRowObject().GetCell('STATUS').SetText('Awensend', true); } if (cellIndex == 18) { grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetValue(now); grid.GetSelectedObject().ToRowObject().GetCell('ABREISE').SetText(datum.toString(), true); }
Hope this helps.Regards,Hans K.
Hello,Thank you for the reply.I apologize for the inconvenience.This issue appears due to the WebGrid doesn’t enter edit mode when you double click on the cell.I made a WebGrid page. I bind the WebGrid to access data source (Northwind.mdb & Shippers table) and set the OnCellDblClick client event to the WebGrid as well.In OnCellDblClick event, I try to make changes on Phone column.Here’s the Javascript code:
function WebGrid1_OnCellDblClick(controlId, tblName, rowIndex, cellIndex, cellEl){ var WebGrid1 = ISGetObject(controlId); var RowObject = WebGrid1.GetSelectedObject().ToRowObject() var CellObject = RowObject.GetCell('Phone'); CellObject.ActivateEdit(); CellObject.SetText("123456", true); CellObject.SetValue("123456"); RowObject.SetDataChanged(); // indicates that this row's data has been changed. WebGrid1.MarkEdit(); // sets the row's status as edited, as if user has typed inside the cell. return true; }
Please kindly have review on the page as well. You could get the page from this link: http://1drv.ms/1bNO8dJHope this helps.Regards,Hans K.
Hello Hans Kristian,
is there another way to Identify the Column which got double clicked? Because if i move the column, so that column has a different cellindex then before and the value gets set to the wrong column.
Hello,Here’s the snippet example code how to get name of the double clicked column:
function WebGrid1_OnCellDblClick(controlId, tblName, rowIndex, cellIndex, cellEl){ var WebGrid1 = ISGetObject(controlId); alert(WebGrid1.RootTable.Columns[cellIndex - 1].Caption); return true; }
Hope this helps.Thank you.Regards,Hans K.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname