Webgrid doesn't update row after OnCellDblClick

5 replies. Last post: May 13, 2014 11:18 PM by Hans Kristian
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Eray GeveciMember

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;
      }

 

All times are GMT -5. The time now is 8:15 PM.
Previous Next