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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of session in web application?

485


What is owin authentication?

520


what are the ihttphandler and ihttphandlerfactory interfaces ?

514


What is the difference between union and join?

565


What does ascx stand for?

510






Which two new properties are added in asp.net 4.0 page class?

525


What is the difference between page directive include and action tag include?

526


Explain the different types of assemblies?

527


Explain the difference between codebehind="mycode.aspx.cs" and src="mycode.aspx.cs"?

538


How can we create custom controls in asp net?

534


Who is using asp.net?

503


What is state management technique?

543


Explain the main differences between asp and asp.net?

516


What kind of programming language is ASP.NET?

610


What is a query string in a url?

539