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
Which method do you use to enforce garbage collection in .net?
How to register exception filter globally?
Can we use html in asp.net?
What are the best practices to follow to secure connection strings in an ASP.NET web application?
How does output caching work in ASP.NET?
To display data in a Repeater control which template you provide?
What happens if an ASP.NET server control with event-handling routines is missing from its definition?
Which validator control you use if you need to make sure the values in two different controls matched?
Explain about secure socket layer?
How dataadapter.fill works?
How can you make sure that web api returns json data only?
What is data binding in asp net?
What does the hotspot class in .net do?
What is the difference between WindowsDefaultLocation and WindowsDefaultBounds?
How to change Master page in ASP.Net using code?