Reputation: 16194
Hi i have a usercontrol
embedded in multiple pages and i want to capture that from where that the usercontrol
is loaded (from which parent page)
how to do this ? ,
Upvotes: 0
Views: 563
Reputation: 23113
From the control, you can call Page.ToString()
which should return something like 'ASP.TestPage_aspx'
Upvotes: 0
Reputation: 23113
In your control, you can call CurrentExecutionFilePath which will provide you the path and page currently executing. If you're only interested in the filename, simply strip off the first part looking for LastIndexOf("/").
Upvotes: 0
Reputation: 176886
Expose the thing as public Property than you able to access those in your child ones thats better way to do it
search your child control form the parent like : parent.FindControl("Controlname")
will do it
Upvotes: 1