Radgrid Row Controls collection client side

2 posts, 0 answers
  1. Clifton Brown
    Clifton Brown avatar
    8 posts
    Member since:
    Jun 2008

    Posted 13 Apr 2009 Link to this post


    I need to be able to add dynamically created textboxes to my Grid rows. I'm doing that in the grid's ItemCreated event. However, on post back my text boxes are being recreated and therefore losing their values. I don't want to have to recreat my textbox controls in Page_Init. I had an idea to read the textbox values on the client side and write them to a hidden field control. The problems is that I can't figure out how to access the SelectedRow's controls collection to find my text boxes.
    Also, the number of text boxes per row is also dynamic. Meaning Row 1 may have just 1 textbox while Row 2 has 3. This is why  i need to be able to dynamically loop the row's controls since I won't know exactly how many text boxes were created for a given row
    Here is what I'm trying to do


    function RowSelected(row)





        for (i=0;i<row.Controls.count;i++)




            if (row.Controls[i].type == "text")//if the type of control is textbox










    I'm getting a javascript error that controls.count is null

    How can  I accomplish this task? It's doesn't have to be the same solution as outlined above. I just need to be able to create those text boxes at run time and access their values on the server at postback.

    Thanks in advance ;)

  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 16 Apr 2009 Link to this post

    Hi Clifton,

    Could you please elaborate a bit on your scenario as I am not sure I do properly understand what you are trying to achieve?
    You said that the TextBox controls are added on ItemCreated, but when what text are you setting to them? And what actions are performed so their text is lost?

    Sincerely yours,
    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.
Back to Top