Reference a control in Page_Load

5 posts, 1 answers
  1. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 13 Aug 2009 Link to this post

    How can I reference to a TextBox inside an EditFormTemplate in Page_Load (if IsPostBack = true) after editing an item in the EditFormTemplate?
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 13 Aug 2009 Link to this post

    Hello Roy,

    To see more information on the requested functionality, please refer to the following help article:
    Referencing controls in grid row/edit form

    Kind regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 13 Aug 2009 Link to this post

    Thanks, but that article does not answer my question.
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Aug 2009 Link to this post

    Hello Roy,

    You can loop through the Edit Item Collection and access the controls as shown below:
    c#:
    protected void Page_Load(object sender, EventArgs e) 
        { 
            if (IsPostBack) 
            { 
                foreach (GridEditableItem item in RadGrid1.EditItems
                { 
                    TextBox txtbx = (TextBox)item["ColumnUniqueName"].Controls[0]; 
                } 
            } 
        } 

    Thanks
    Princy.
  6. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 13 Aug 2009 Link to this post

    Thanks, Princy !!!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017