Get the control id of usercontrol in aspx page
I'm working on asp.net website. In my project I'm using the usercontrols. I have placed the rad开发者_如何学运维grid inside the user controls. I need to get the id of radgrid of usercontrol and need to enable the scrolling for the grid. How can I achieve this. please help me
You can add public property of type radgrid in your UserControl
which will allow you to access it simply like idOfUserControl.RadGrid.ClientID
and this is how to add property:
public YourUserControl : UserControl
{
public RadGrid Grid { get; set; }
public void Page_Load(...)
{
Grid = idOfRadGrid; //idOfRadGrid = id of RadGrid specified in aspx markup
}
}
精彩评论