Linq database delete database from gridPanel not success

  1. #1

    Linq database delete database from gridPanel not success





    I use linq connect database.The Create/Update are success ,noly the delete not.the data remove from grilPanel, but not delete from database.
    Following is my code

    
       <SelectionModel>
                 <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">                                         
                      <Listeners>
                                                    <RowDeselect Handler="if (!#{GridPanel1}.hasSelection()) {#{btnDelete}.disable();}" />                                            
                        </Listeners>  
                    </ext:RowSelectionModel>
      </SelectionModel>
             
        <ext:Button ID="btnDelete" runat="server"  Text="delete" Icon="Delete"  AutoPostBack="false">
             <Listeners>                  
               <Click Handler="Ext.Msg.confirm( <Click Handler="Ext.Msg.confirm('Confirm','Are you sure?',function(btn){if(btn=='yes'){#{GridPanel1}.deleteSelected();if(!#{GridPanel1}.hasSelection()){#{btnDelete}.disable();}}});" />
               </Listeners>
          </ext:Button>

    cs code
            protected void Store1_BeforeChange(object sender, BeforeStoreChangedEventArgs e)
        {
            string json = e.DataHandler.JsonData;
            StoreDataHandler dataHandler = new StoreDataHandler(json);
            ChangeRecords<Teacher> data = dataHandler.ObjectData<Teacher>();
    
    
            foreach (Teacher teacher in data.Deleted)
            {
                ss.Teacher.Attach(teacher);
                ss.Teacher.DeleteOnSubmit(teacher);
            }
    
    
            foreach (Teacher teacher in data.Updated)
            {
                ss.Teacher.Attach(teacher);
                ss.Refresh(RefreshMode.KeepCurrentValues, teacher);
            }
    
    
            foreach (Teacher teacher in data.Created)
            {
               ss.Teacher.InsertOnSubmit(teacher);
            }
            ss.SubmitChanges();
            this.GridPanel1.Reload();
        }
    Waiting for answer....

    Thank you very much!!!
  2. #2
    Hi,

    Im facing some problem here with row update in GridPanel. Im using LINQ as ORM and in GridPanel im using RowEditor plugin. I can find the updated data from grid and datacontext.submitchange is executing without any exception but there is no impact in DB table. I think im missed something. Could you please show me the snippets on how you used your GridPanel to work it with linq?

    Though this thread of your's is 2+ years old, yet im hoping you might notice my post and help me with my issue.

    Thanks
  3. #3
    Hi @reezvi,

    Please clarify is the thread with the same problem?
    http://forums.ext.net/showthread.php?14792
  4. #4
    Hi Daniil,

    Yes, that's the thread. Thanks that you noticed.
  5. #5
    Ok, lets continue the thread that you initially started.
  6. #6
    k Daniil. thanks

Similar Threads

  1. Replies: 2
    Last Post: Feb 18, 2012, 1:57 AM
  2. Replies: 1
    Last Post: Jul 06, 2011, 11:22 PM
  3. Replies: 0
    Last Post: Jul 23, 2010, 6:35 AM
  4. Replies: 4
    Last Post: Oct 18, 2009, 7:06 AM
  5. Replies: 1
    Last Post: Jun 11, 2009, 3:59 AM

Posting Permissions