suman
suman

Reputation: 728

Use usercontrol id of ascx page in aspx page

I have a usercontrol.The usercontrol in included in a master page.Now i have yet another page a aspx page.The aspx page is inheriting the masterpage.So how do i access the id of usercontrol in aspx page.

Upvotes: 0

Views: 697

Answers (1)

user35
user35

Reputation: 468

So you have no direct relation of aspx page with the usercontrol page.In such case make a public function in the master page of type usercontrol

public yourusercontrol getucID()
 {
  return usercontrol_id
 }

Now you can use this function to get usercontrol id in your aspx.cs page.

yourmaster mst = (yourmaster)Page.Master;
 yourusercontrol yuc = mst.getucID();
 //Now do your stuff with yuc

I hope it Helps

Upvotes: 1

Related Questions