c# - ASPxGridView DeleteRow not deleting on another control callback -


i'm using devexpress's gridview , have code deletes selected gridview row control's customcallback,

the line

gridfrom.deleterow(int.parse(rowkey[2]));

retrieves correct visibleindex not remove row gridview. databind not refreshes gridview's data , requires refreshing of page data update

    protected void aspxtreelist1_customcallback(object sender, devexpress.web.aspxtreelist.treelistcustomcallbackeventargs e)     {         string[] rowkey = e.argument.split('|');          string strconnectionstring = configurationmanager.connectionstrings["dbname"].connectionstring;         using (sqlconnection conn = new sqlconnection(strconnectionstring))         {             string query = "delete table id=@id";              using (sqlcommand cmd = new sqlcommand(query, conn))             {                 conn.open();                 cmd.parameters.addwithvalue("@id", rowkey[0]);                 cmd.executenonquery();                 conn.close();             }          }         gridfrom.deleterow(int.parse(rowkey[2])); //rowkey[2] visibleindex         gridfrom.databind();     } } 

it requires refreshing of page data update

you don't see grid changes, because only aspxtreelist updated during its own callback.

as possible solution, disable aspxtreelist's callbacks or delete grid row using grid's customcallback instead (in similar manner).

<dx:aspxtreelist id="aspxtreelist1" runat="server" enablecallbacks="false"> </dx:aspxtreelist> 

check the concept of callbacks - why impossible update external control data during callback control learning guide regarding this.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -