asp.net - How to avoid page reload after inserting data into the gridview -


i have gridview in asp.net page. when insert data gridview whole page reload. how avoid this? here code

 protected void addnewcustomer(object sender, eventargs e) {      control control = null;     if (gridview1.footerrow != null)     {         control = gridview1.footerrow;     }     else     {         control = gridview1.controls[0].controls[0];     }     string slno = (control.findcontrol("txtslno") textbox).text;     string code = (control.findcontrol("txtcode") textbox).text;     string details = (control.findcontrol("txtdetails") textbox).text;     using (sqlconnection con = new sqlconnection(""))     {         using (sqlcommand cmd = new sqlcommand())         {             cmd.connection = con;             cmd.commandtype = commandtype.text;             cmd.commandtext = "insert [qtattemp] values(@code,@details,@slno)";             cmd.parameters.addwithvalue("@slno", slno);             cmd.parameters.addwithvalue("@code", code);               cmd.parameters.addwithvalue("@details", details);             con.open();             cmd.executenonquery();             con.close();         }     }     response.redirect(request.url.absoluteuri); } 

i think issue cause response.redirect(request.url.absoluteuri); so,you need specify after function completion.it might solve problem.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -