3

I am using a big form, and in this form I have about 3 grids and many texboxes, I would like to create new elements in these grids without needing to refreshing all the page, so I can post all the form at once.

I am trying to make the operations of Update, Delete and Add only on the client-side, without any post.

EDITED

I successfully achieved these operations using AJAX calls and using a ViewState as a DataTable. This because of the attribute CallBackMode, but in my opinion is doing an unecessary POST, even if it is an AJAX call, since it all could be handled only on the client-side, by javaScript.

My grid is like bellow.

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="Panel2" runat="server">
                <obout:Grid ID="Grid1" AllowPageSizeSelection="false" AllowSorting="false" AllowMultiRecordSelection="false"
                    AllowAddingRecords="true" FolderLocalization="~/Localization/Grid" FolderStyle="~/Styles/grid/premiere_blue"
                    AutoGenerateColumns="false" DataKeyNames="id" AllowPaging="false" runat="server"
                    Serialize="true" CallbackMode="true" ClientIDMode="Static">
                    <Columns>
                        <obout:Column ID="Column1" Visible="false" HeaderText="Edit" Width="100" />
                        <obout:Column ID="Column2" DataField="pro_ncm" HeaderText="NCM" runat="server" Width="20%" />
                        <obout:Column ID="Column3" DataField="pro_descricao" HeaderText="Principais Produtos Fabricados"
                            Width="20%" Wrap="true" runat="server" />
                        <obout:Column ID="Column4" DataField="pro_capacidade" HeaderText="Capacidade Produtiva/Ano"
                            Width="20%" Wrap="true" runat="server" />
                    </Columns>
                </obout:Grid>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
Tito
  • 722
  • 4
  • 26
  • 55

2 Answers2

0

The short answer is:

<obout:Grid id="grid1" CallbackMode=false" ...

or dynamically with javascript:

grid1.CallbackMode = false
web_bod
  • 5,728
  • 1
  • 17
  • 25
  • That will switch it off completely, do you need to be able to toggle postbacks during the lifetime of the page? – web_bod Oct 25 '13 at 19:53
  • Thanks for your anwser @web_bod, I made it false, but is adding one new row in the grid. But when I try to add a new one, it gives an error in javaScript: "this.LoadingMessageContainer is null" (in FireFox) – Tito Oct 25 '13 at 20:02
  • Update your question to explain what you are trying to achieve, might be able to help. – web_bod Oct 25 '13 at 20:15
  • The problem with CallBackMode is that it doesn`t turn off the POST, it just make it an AJAX call, from obout documentation: "When the Grid is in callback mode, all the actions (sorting, paging, editing etc.) are executed without reloading the page, using AJAX callbacks." – Tito Oct 31 '13 at 11:41
0

there is a sample in obout web site to accomplish what you ask: http://www.obout.com/grid/commands/aspnet_commands_client_side_changes.aspx

enricoariel
  • 483
  • 2
  • 10