【正文】
publicoverridevoidVerifyRenderingInServerForm(Controlcontrol){if(!().(DataGridLinkButton)){(control)。}}因?yàn)槲倚枰贏jaxMethod中獲得一個(gè)控件的HTML輸出到畫面上,而這個(gè)控件是我new出來(lái)的,顯然不可能在form runat=server 標(biāo)記內(nèi),于是我就加了個(gè)判斷,雖然還是沒(méi)有做到十全十美(就是如果畫面上本來(lái)就有的DataGridLinkButton也不做驗(yàn)證了。)但感覺比起直接把base方法調(diào)用注釋掉還是合情合理些。木野狐對(duì)這個(gè)問(wèn)題也有篇文章描述了下。 返回什么,怎樣結(jié)合他確定是否將自定義控件寫到頁(yè)面上?saucer(思?xì)w)回復(fù)于 20041209 09:09:38 try to override AddAttributesToRender, for example, this is how it is done with LinkButton if you use Reflector to see the implementation: protected override void AddAttributesToRender(HtmlTextWriter writer) { if ( != null) { (this)。 } (writer)。 .... }