I have a method written in WebForm (means .aspx page) & now
I want to call this method in WebUserControl (means .ascx
page) what should I have to do?



I have a method written in WebForm (means .aspx page) & now I want to call this method in WebU..

Answer / jp

Use the controls page property and typecast it to the page
class name.

eg:
Page Default.aspx has a control MyControl.ascx
Page Default.aspx.cs has a method MyMethod()

in MyControl.ascx.cs

((Default)(this.Page)).MyMethod();

Is This Answer Correct ?    7 Yes 8 No

Post New Answer

More ASP.NET Interview Questions

What is server components?

0 Answers  


Let's say I have an existing application written using vb6 and this application utilizes windows 2000 com+ transaction services. How would you approach migrating this application to.net?

0 Answers  


What is Web API?

0 Answers  


How to use ipostback?

0 Answers  


What is difference b/w Data Grid in ASP.Net 1.1 and Gridview in 2.0

11 Answers   Bosch, IntraLogic,






How do you register a .NET assembly?

3 Answers   Microsoft,


Hi! Could any 1 please suggest me a free practice online exam for asp.net exams.. thanks

1 Answers  


Is it true that a Web service must be written in .NET or not?

0 Answers   Siebel,


What are the data controls available in asp.net?

0 Answers  


Which property is used to identify the Page is Post Back in ASP.NET?

0 Answers   Sans Pareil IT Services,


Is it possible to perform data validations in the database?

1 Answers   Quest,


Describe the diffeerence between inline and code behind?

0 Answers  


Categories