Grid - part of name of FormTemplate control

2 posts, 0 answers
  1. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 05 Oct 2008 Link to this post


    I have a Grid width PopUp style editing like :
    <EditFormSettings EditFormType="Template" >      
                               <asp:TextBox id="TextBox7"  runat="server"
                               Text='<%# DataBinder.Eval( Container, "DataItem.FieldName" ) %>'>
                            <br />
                               <asp:Button ID="UpdateButton" OnClientClick="GetNewData(this, event);" Text="Update"
                                     runat="server" />

    ... and I have JavaScript finction like :

    function GetNewData(sender, e)
      var grid = $get("Grid1");
      var inputs = grid.getElementsByTagName("input");
      for (var i = 0; i < inputs.length; i++)
        var input = inputs[i];
        if ( == "Grid1_ctl00_ctl05_" + "TextBox7")

    Every thing work well but I have't got grid id directly from JavaScript code. I need this becoures I have to find control named "Grid1_ctl00_ctl05_TextBox7".
    My question is : How can I get grid unique id like "Grid1_ctl00_ctl05_" ??? 

  2. Yavor
    Yavor avatar
    11 posts

    Posted 08 Oct 2008 Link to this post

    Hello Krzysztof,

    One possible approach in this case is to use the code-behind and get the id there. This id can be assigned to a hidden input on the page, which can later be accessed to get the id of the element you need.
    I hope this is a suitable approach for you.

    Best wishes,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
Back to Top