This is a migrated thread and some comments may be shown as answers.

How to get the elements of a new row in a grid at client side?

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yu
Top achievements
Rank 1
Yu asked on 12 Nov 2010, 12:36 AM
<telerik:GridTemplateColumn UniqueName="MyColumn" DataField="MyColumn">
    <ItemTemplate>
        <telerik:RadComboBox ID="rcbMyList" runat="server"
            OnClientSelectedIndexChanged="MyListChanged" >
        </telerik:RadComboBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>

A master view of a gird is set to EditMode="InPlace" and InsertItemDisplay="Bottom". Suppose a new row has been added by clicking a button and the new row looks like just another "existing" row.

What I need is, updating other elements in the new row when the index of a combo box in the new row is changed, and all things should be done at client side.

I tried to set up a client event handler but I don't know how to get the elements in the new row in my event handler (javascript). I would say my javascript works for existing rows - I can get any row from the object "sender.get_parent()" - but it doesn't work for the new row.

Any idea about this problem?

--Y. Fan

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Nov 2010, 08:40 AM

Hello,

One suggestion is saving ColumnUniqueName and containing control's ClientID in array. Which means mapping between the client ID and the columnuniquename. In the ItemCreated event, get reference to the editform and iterate through the controls inside. Now save the ColumnUniqueName and ClientIDs in the client array. Attach a client side method also to get the ClientID.

The same approach is shown here in this link:

Master Pages and JavaScript document.getElementById

 

Thanks,
Princy.

0
Yu
Top achievements
Rank 1
answered on 18 Nov 2010, 04:21 PM
Thanks for your reply. I didn't try your solution but I appreciate your quick response that makes me feel good, as someone is helping me and trying to work out a solution. :-)

I eventually worked out a solution - not the best but enough for now (doesn't work in firefox) - get the "<tr>" element in the grid by looking for the sender's parent elements and go through all cells in the row, then find the element that I need in table cell.

I hope there would be a "offical" support for the feature that we were just talking about in telerik radgrid, which could make our life easier...

-- Y. Fan
Tags
Grid
Asked by
Yu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Yu
Top achievements
Rank 1
Share this question
or