Public override void verifyrenderinginserverform (Control) {} protected void linkbutton2_click (Object sender, eventargs e) {response. clear (); response. buffer = true; response. charset = "gb2312"; response. contentencoding = system. text. encoding. getencoding ("gb2312"); response. appendheader ("content-disposition", "attachment; filename = \" "+ system. web. httputility. urlencode ("data export", system. text. encoding. utf8) + ". XLS \ ""); response. contenttype = "application/MS-excel"; system. io. stringwriter ostringwriter = new system. io. stringwriter (); system. web. UI. htmltextwriter ohtmltextwriter = new system. web. UI. htmltextwriter (ostringwriter); this. label1.rendercontrol (ohtmltextwriter); this. gridview1.rendercontrol (ohtmltextwriter); response. output. write (ostringwriter. tostring (); response. flush (); response. end ();}