1
votes

i'm trying to use ext.net gridpanel in my projet.The point is i cannot delete store datas from database.i added row command and button for try to deletion with direct method.But not fired.I'm using entity framework at the code behind and storing gridpanel with it.How can i delete or edit stores from database when i click to row command deletion or editing.Am i missin proxy or another method?I m new at ext.net.

**

<ext:GridPanel
        ID="GridPanel1"
        runat="server" 
        Title="Control Test" 
        Width="700">
        <Store>
            <ext:Store ID="Store1" runat="server" OnReadData="Store1_ReadData" AutoSync="true" PageSize="10">
                <Model>
                    <ext:Model ID="Model1" runat="server">
                        <Fields>
                            <ext:ModelField Name="ID" />
                            <ext:ModelField Name="Controllor"  />
                            <ext:ModelField Name="Process" />
                            <ext:ModelField Name="Control"  />
                            <ext:ModelField Name="ControlType" />
                            <ext:ModelField Name="ControlPlace" />
                            <ext:ModelField Name="AuditeeUnit" />
                        </Fields>
                    </ext:Model>
                </Model>  


            </ext:Store>

        </Store>

        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="35" />
                <ext:Column ID="Column1" runat="server" Text="Controllor" DataIndex="Controllor" Flex="1" />
                <ext:Column ID="Column2" runat="server" Text="Process" Width="75" DataIndex="Process">

                </ext:Column>
                <ext:Column ID="Column3" runat="server" Text="Control" Width="75" DataIndex="Control">

                </ext:Column>
                <ext:Column ID="Column4" runat="server" Text="Control Type" Width="75" DataIndex="ControlType">

                </ext:Column>
                  <ext:Column ID="Column5" runat="server" Text="Control Area" Width="75" DataIndex="ControlPlace">

                </ext:Column>
                <ext:Column ID="Column6" runat="server" Text="Unit" Width="75" DataIndex="AuditeeUnit">

                </ext:Column>
               <ext:CommandColumn ID="CommandColumn1" runat="server" Width="60">
                    <Commands>
                        <ext:GridCommand Icon="Delete" CommandName="Delete" OnDataBinding="Unnamed_DataBinding" AutoDataBind="True">                              
                            <ToolTip Text="Delete" />

                        </ext:GridCommand>
                        <ext:CommandSeparator />
                        <ext:GridCommand Icon="NoteEdit" CommandName="Edit">
                            <ToolTip Text="Edit" />
                        </ext:GridCommand>
                    </Commands>
                    <Listeners>                           
                        <Command Handler="if (command == 'Delete') {App.direct.testmethod();}"/>
                    </Listeners>
                </ext:CommandColumn>

            </Columns>
        </ColumnModel>
        <TopBar>

               <ext:Toolbar ID="UsersGridPanelPowerUserToolbar" runat="server">
                  <Items>                         
                     <ext:Button ID="UserRemoveButton" runat="server" Text="Delete" Icon="Delete" Disabled="false" StandOut="true">

                          <Listeners>

                           <Click Handler="App.direct.testmethod();" /> 
                        </Listeners>
                          <DirectEvents>
                           <Click  OnEvent="Unnamed_Event"></Click>

                           </DirectEvents>

                     </ext:Button>
                     <ext:ToolbarSeparator></ext:ToolbarSeparator>

                  </Items>
               </ext:Toolbar>
            </TopBar>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" Mode="Multi" />
        </SelectionModel>
        <View>
            <ext:GridView ID="GridView1" runat="server" StripeRows="true" />                   
        </View>            
        <BottomBar>
             <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                <Items>
                    <ext:Label ID="Label1" runat="server" Text="Page size:" />
                    <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                    <ext:ComboBox ID="ComboBox1" runat="server" Width="80">
                        <Items>
                            <ext:ListItem Text="1" />
                            <ext:ListItem Text="2" />
                            <ext:ListItem Text="10" />
                            <ext:ListItem Text="20" />
                        </Items>
                        <SelectedItems>
                            <ext:ListItem Value="10" />
                        </SelectedItems>
                        <Listeners>
                            <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                        </Listeners>
                    </ext:ComboBox>
                </Items>
                <Plugins>                      
                    <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                </Plugins>
            </ext:PagingToolbar>
        </BottomBar>
    </ext:GridPanel>

**

 [DirectMethod]
    public void testmethod()
    {
        X.Msg.Alert("DirectMethod", "hello").Show();

        ModelProxy prox = new ModelProxy(Store1);
        //AbstractProxy absprox = JsonPProxy
        prox.Store.DataBind();
        //prox.Destroy();
        //prox.Store.ServerProxy.RemoveAt();
        prox.Store.Destroy();//tested for data deletion

        Store1.CommitChanges();//it has sent communicate for changed data at server data

    }
1
Please demonstrate the definition of the "testmethod" DirectMethod.Daniil Veriga
Just i tested deletion but not changed at server side.I used simple delete function at aspx in ext.net examples but just client deleted.Erbil Delil
Please clarify is the "testmethod" executed or not?Daniil Veriga
Today it fired.Maybe it can be a bug about vs2012.But still not founded deletion from sqlErbil Delil
"not founded deletion from SQL" - do you mean that you don't know how to delete records from a SQL database?Daniil Veriga

1 Answers

0
votes

Maybe this helps you:

http://msdn.microsoft.com/en-gb/library/ms228366%28v=vs.80%29.aspx

just change the connectionstring to your own and the SELECT statement with something like

"DELETE FROM <Table> WHERE ID= "+selectedRowID

be sure to provide the serverside method the ID of the selected Row:

App.direct.testmethod(record.data.ID);