【正文】
SelectedRowStyle BackColor=E2DED6 FontBold=True ForeColor=333333 / /asp:GridView SelectCommand=SELECT * FROM [stu]/asp:SqlDataSource /form/body/htmlusing 。using 。public partial class 將GridView導(dǎo)出到Excel_excel : { public void ExportToExcel(string FileType, string FileName) { {//都可以 public override void VerifyRenderingInServerForm(Control control)publiccontrol){//form發(fā)送回或依賴于注冊的腳本塊的控件應(yīng)該在如果回送或使用客戶端腳本的服務(wù)器控件沒有包含在runat=server)控件中時(shí)提供明確的錯(cuò)誤信息。這在輸入控件調(diào)用除非要?jiǎng)?chuàng)建替換頁框架,否則請不要重寫此方法。VerifyRenderingInServerForm(Control}}因?yàn)槲倚枰贏jaxMethod中獲得一個(gè)控件的HTML輸出到畫面上,而這個(gè)控件是我new出來的,顯然不可能在form runat=server 標(biāo)記內(nèi),于是我就加了個(gè)判斷,雖然還是沒有做到十全十美(就是如果畫面上本來就有的DataGridLinkButton也不做驗(yàn)證了。 to how with use the AddAttributesToRender(HtmlTextWriter ( (this)。 } .... { null) override to if is this AddAttributesT