Find Row Value of radgrid on client side

3 posts, 0 answers
  1. Tolga
    Tolga avatar
    1 posts
    Member since:
    Jan 2013

    Posted 28 Jan 2015 Link to this post

    Hello,I have a radgrid with some bound columns. In one of the bound columns, it has ImageButton. All I want is Javascript function when I click the button i want to get value of this row of the button.

    It means when I click ImageButton 'CizelgeAc' I want to get EKD_ID of this selected row. my javascript function is 'cizelgeAc1(this,event)

    <telerik:GridTemplateColumn HeaderText="Kurs Prog. Çiz." UniqueName="KursProgCiz" DataField="EKD_ID" SortExpression="EKD_ID" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" AllowFiltering="false">
                                                        <asp:ImageButton ID="CizelgeAc" CommandName="ES" runat="server" CausesValidation="false" OnClientClick="cizelgeAc1(this,event)"
                                                            Visible='<%# (((((string)Eval("EGT_TIPI").ToString() == "V"))) ? true : false) %>'
                                                            ImageUrl="~/Images/AddRecord.gif" />
                                                        <asp:Label runat="server" Visible='<%# (((((string)Eval("EGT_TIPI").ToString() == "A"))) ? true : false) %>' Text="-"></asp:Label>
                                                        <%--                                                    <asp:Image ID="imageKursProgCiz" runat="server" ImageUrl="~/Images/Cancel.gif" Visible='<%# (((((string)Eval("EGT_TIPI").ToString() == "A"))) ? true : false) %>' />                                                  --%>

    Javascript Function : 

    function cizelgeAc1(button, args) {
                    var row = Telerik.Web.UI.Grid.GetFirstParentByTagName(button, "tr");
                    //guarantee to get to the table row
                    while (!( &&"__") > -1)) {
                        row = Telerik.Web.UI.Grid.GetFirstParentByTagName(button, "tr");
                    //get index
                    var index ="__")[1];
                    //get all table data items
                    var tableId ="__")[0];
                    var tableView = $find(tableId);
                    //find the data item related to the row id
                    var dataItem = $find(;
                    var grid = button;
                    var MasterTable = EgitimTalepleriRadGrid.get_masterTableView();
                     var cell= grid.get_masterTableView().get_dataItems()[0].get_cell("EKD_ID").innerHTML;

    I got the row index but I couldn't reach value of 'EKD_ID' in this way.

  2. Eyup
    Eyup avatar
    4046 posts

    Posted 02 Feb 2015 Link to this post

    Hello Tolga,

    You can use following approach to achieve the requested functionality:
    <MasterTableView ... ClientDataKeyNames="OrderID">
    ImageButton definition:
    <asp:ImageButton ... OnClientClick='<%# "cizelgeAc1(this,event,"+Container.ItemIndex+",\""+
                                Container.OwnerTableView.ClientID+"\"); return false;" %>'/>
    function cizelgeAc1(button, event, index, tableViewID) {
        var tableView = $find(tableViewID);
        var item = $find(tableViewID).get_dataItems()[index];
        var value = item.getDataKeyValue("OrderID");

    Hope this helps. Please give it a try and let me know if it works for you.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Ilaya
    Ilaya avatar
    3 posts
    Member since:
    Mar 2012

    Posted 13 Dec 2018 in reply to Eyup Link to this post

    Hi Sir,

    Its is Working Perfectly . thank you so much.



Back to Top