How to trigger WebGrid's ASP DataSource to insert/update/delete data?

2 replies. Last post: October 1, 2010 12:25 PM by Shawn August
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Shawn AugustMember

I have a WebGrid that uses an ASP DataSource to insert/update/delete data. This gets triggered if I delete a row or insert/update data and leave the row to another row. It will also trigger if I click on a button that loses focus on the grid.  However, I have this page in a WinForms application using a WebBrowser object. The WinForm object has UI that brings the user from different pages but this doesn't trigger the WebGrid to update if they click on the "Add new row" and enter some default data and then immediately click on the WinForm's node to leave. Is there a way in javaScript to trigger this update?

 

<div class="ContentTemplateGridContent">

<CommonCtrl:EnduranceWebGrid ID="grdFTPInformation" runat="server" UseDefaultStyle="True"
    Width="100%" Height="100%" DefaultStyleMode="Elegant" 
    DataSourceID="odsFTPInformation" 
    onpreparedatabinding="grdFTPInformation_PrepareDataBinding"
    OnInitializePostBack="grdFTPInformation_InitializePostBack">

    <LayoutSettings 
            AllowEdit="Yes" 
            AllowAddNew="Yes" 
            AllowColumnSizing="No" 
            AllowDelete="Yes" 
            RowHeightDefault="22px"
            AllowFilter="No" 
            AllowSelectColumns="Yes" 
            AllowSorting="Yes" 
            HideColumnsWhenGrouped="Default" 
            NewRowLostFocusAction="AlwaysPrompt" 
            AllowExport="Yes" 
            ResetNewRowValuesOnError="False" 
            InProgressUIBehavior="ChangeCursorToHourGlass" 
            TreeLines="False" 
            ApplyFiltersKey="Enter" 
            AllowColumnFreezing="Yes" 
            ShowFilterStatus="True" 
            PagingMode="ClassicPaging" 
            EditOnClick="True" 
            VerboseEditingInformation="True" 
            FilterBarVisible="True" 
            PagingSize="50" 
            PagingExportMode="ExportAllData" 
            PromptBeforeDelete="true"
            virtualloadmode="LargeData" 
            CellPaddingDefault="0">

        <FrameStyle CssClass="WebGridFrameStyle"></FrameStyle>
        <HeaderStyle CssClass="WebGridHeaderStyle" />
        <StatusBarStyle CssClass="WebGridStatusBarStyle" />
        <StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" 
                               Normal-CssClass="WebGridStatusBarCommandStyleNormal" 
                               Over-CssClass="WebGridStatusBarCommandStyleOver" />
        <FilterRowStyle CssClass="WebGridFilterRowStyle" />
        <PreviewRowStyle CssClass="WebGridRowStyle" />
        <RowStyle CssClass="WebGridRowStyle" />
        <QuickFilterBarStyle CssClass="WebGridRowStyle" />
        <RowHeaderStyle CssClass="WebGridRowHeaderStyle" />
        <SelectedRowStyle CssClass="WebGridSelectedRowStyle" />
        <EditFocusCellStyle CssClass="WebGridRowStyle" />
        <FocusCellStyle CssClass="WebGridRowStyle" />
        <LostFocusRowStyle CssClass="WebGridRowStyle" />
        <NewRowStyle CssClass="WebGridRowStyle" />
        <SortedColumnStyle CssClass="WebGridSortedColumnStyle" />
        <AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" />
        
        <FreezePaneSettings AbsoluteScrolling="True" 
        ActiveFrozenColumns="1" ShowInContextMenu="False" ShowSplitterLine="False" MaxFrozenColumns="1" SplitterLineColor="ActiveBorder" SplitterLineWidth="1" />
    </LayoutSettings>

    <RootTable DataKeyField="FtpID">
        <Columns>
            <ISWebGrid:WebGridColumn Name="FtpID" DataMember="FtpID" Caption=" " Visible="false" DataType="System.Int32"/>
            <ISWebGrid:WebGridColumn Name="ProgramID" DataMember="ProgramID" Caption=" " Visible="false" DataType="System.Int32"/>
            <ISWebGrid:WebGridColumn Name="FtpUrl" DataMember="FtpUrl" Caption="URL" DataType="System.String"
                                     Width="300px" EditType="TextBox" EditInfoText="Enter FTP Url" 
                                     InputRequired="true" InputRequiredErrorText="FTP URL is required" ColumnType="HyperLink"/>
            <ISWebGrid:WebGridColumn Name="FtpUserName" DataMember="FtpUserName" Caption="Username" DataType="System.String"
                                     Width="100px" EditType="TextBox" EditInfoText="Enter FTP Username" />
            <ISWebGrid:WebGridColumn Name="FtpPassword" DataMember="FtpPassword" Caption="Password" DataType="System.String"
                                     Width="100px" EditType="TextBox" EditInfoText="Enter FTP Password" />
            <ISWebGrid:WebGridColumn Name="FtpComments" DataMember="FtpComments" Caption="Comments" DataType="System.String"
                                     EditType="TextBox" Visible="true" IsAutoWidth="true" Width="100%" />
            <ISWebGrid:WebGridColumn Name="ModifiedBy" DataMember="ModifiedBy" Caption=" " DataType="System.String"
                                     Visible="false" />
                                                 
        </Columns>
    </RootTable>
</CommonCtrl:EnduranceWebGrid>
</div>

<asp:ObjectDataSource ID="odsFTPInformation" runat="server" 
    DataObjectTypeName="Endurance.Re.AWB.Data.FTPInformation" 
    OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetFTPInformationList" 
    TypeName="Endurance.Re.AWB.Web.Controllers.ProgramController"
    DeleteMethod="DeleteFTPInformatin"
    InsertMethod="UpdateFTPInformation"
    UpdateMethod="UpdateFTPInformation">
    <SelectParameters>
        <asp:ControlParameter ControlID="hidProgramID" Name="programID" 
            PropertyName="Value" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
All times are GMT -5. The time now is 2:24 AM.
Previous Next