How to access a control which is in .aspx page from a user control?

  1. #1

    How to access a control which is in .aspx page from a user control?

    Hi,

    How can I access a control which is in .aspx page from a user control?

    I have a gridpanel (gridp) in a .aspx page, and I want to access to that gridpanel from a user control (.ascx)

    How to access the control name?

    I tried the following way:

    gridp.Reload();
    but shows an error (the user control does not access to gridp).
  2. #2
    Please, any idea?
  3. #3
    Hi,

    Using the .FindControl() Method should help. I think you can do something like the following.

    Example

    this.Page.FindControl("GridPanel1") as GridPanel
    Geoffrey McGill
    Founder
  4. #4
    Hi Geoffrey,

    I can´t understand you.
    How can i reload the grid?
  5. #5
    Quote Originally Posted by walle View Post
    Hi Geoffrey,

    I can´t understand you.
    How can i reload the grid?
    Well, the code above will get you an instance of the GridPanel, then you call Methods and set Properties as required.

    Example

    var grid = this.Page.FindControl("GridPanel1") as GridPanel;
    grid.Reload();
    Hope this helps.
    Geoffrey McGill
    Founder
  6. #6
    Hi Geoggrey,

    I got the solution:

    GridPanel mygrid = (GridPanel)this.Page.FindControl("gridp");
    mygrid.Reload();
    This works fine but there is a little problem.
    The grid updates data but not a column with photo.

    How can i update the column photo of the grid?
    Last edited by walle; Apr 14, 2011 at 7:08 PM.
  7. #7
    Hi,

    I'm not 100% sure what you mean, but there are some threads in the forums regarding rendering images in a GridPanel.
    Geoffrey McGill
    Founder
  8. #8
    Hi Geoffrey,

    I found a thread with my problem, as you said, but there is no solution:

    http://forums.ext.net/showthread.php...e-in-gridpanel

    Any idea?

Similar Threads

  1. Replies: 7
    Last Post: Jan 29, 2013, 11:59 AM
  2. Replies: 2
    Last Post: Nov 15, 2012, 12:52 AM
  3. Replies: 0
    Last Post: Sep 21, 2011, 3:14 PM
  4. Replies: 1
    Last Post: Mar 09, 2010, 2:55 AM
  5. Replies: 2
    Last Post: Aug 27, 2009, 8:12 AM

Posting Permissions