Access control inside UserControl (ASCX) in Parent Page (ASPX) using C# in ASP.Net

on May 18, 2017 09:47 AM

There is a UserControl page named as UcGridUI.ascx in my WebApplication, below is the code:

   <cc1:XamGridEx ID="grdXamGrid" runat="server">

I have dragged and dropped this UserControl in Test.aspx page, below is the code:

  <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
  <uc1:UcGridUI ID="UcGridUI_1" runat="server" /> //dragged and dropped usercontrol

I need to know how shall I call and bind the Grid grdXamGrid (using Linq) which is inside UserControl page into Test.aspx.cs page using C# code.

I am using Asp.Net Kindly let me know how to achieve this, considering me as a fresher.

Any help would be appreciated. Thanks in advance.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on May 18, 2017 10:01 AM
on May 18, 2017 10:03 AM
Richa says:

NOTE: The Grid inside UserControl (UcGridUI.ascx) page can be any Grid.

on May 18, 2017 10:13 AM

Hi Richa,

We can help you to find the control in Test page not more then that because you are using Third Party Tool.

So get your control like below.


protected void Page_Load(object sender, EventArgs e)
    //Your Third Party Controller Name.
    AjaxControlToolkit.Accordion ctrl = UcGridUI_1.FindControl("grdXamGrid") as AjaxControlToolkit.Accordion;