c# - Column Values Customisation- Export Excel in ASP.NET -


i have export gridview in excel sheet 2003. code can export data excel sheet directly. if there null value column, how replace empty string in excel sheet. there date column null, there event handler occurs between export button click , loading data excel. if there 1 can compare values in database , can replace null value empty string. in evnt handler.

please point me in right direction.

thank you

on click of export button, can iterate through grid rows , replace whatever need. example, code below replace : .:

protected void btnexport_click(object sender, eventargs e) {     stringwriter sw = new stringwriter();     htmltextwriter htw = new htmltextwriter(sw);      string attachment = "attachment; filename=summaryreport" + datetime.now.tostring() + ".xls";      response.clearcontent();     response.addheader("content-disposition", attachment);     response.contenttype = "application/ms-excel";      foreach (gridviewrow grdrow in grdprojecttasks.rows)     {         label lblactualduration = (label)grdrow.findcontrol("lblactualduration");          lblactualduration.text = lblactualduration.text.replace(":", ".");     }      grdprojecttasks.rendercontrol(htw);      response.write(sw.tostring());     response.end(); } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -