inheritance - How to access child controls inside inherited class? -


here i'm doing, have large amount of reports, rather copy , pasting repeated code, have following..

 public class reportpage : system.web.ui.page {    // code } 

my report pages have

 public class myreportpage : reportpage { } 

problem i'm having is, want able access control inside myreportpage within reportpage, instance, want pages grid have specific property.

inside reportpage tried

protected void page_prerender(object s, eventargs e) {   var obj = this.findcontrol("reportgridname"); } 

but unable find control, went through controls see if in, no luck..

any ideas how grid access on inherit?

page page = (page)httpcontext.current.handler;          var obj = page.findcontrol("reportgridname"); 

does work? i'm having exact same problem , stumbled upon this link


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -