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

Finding row in edit mode from client side API?

2 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 2
Dave asked on 28 Aug 2008, 03:51 AM
I have a radgrid with some textboxes and a button in an edit template like this:

<telerik:GridTemplateColumn DataField="DepositID" HeaderText="Related Deposit #" 
   SortExpression="DepositID" UniqueName="DepositID">  
 <EditItemTemplate> 
    <asp:Label ID="lblDepositID" runat="server" Text='<%# Bind("DepositID") %>' Visible="false"></asp:Label> 
    <asp:Label ID="lblDepositNum" runat="server" Text='<%# Bind("DepositNum")%>' Width="120px" ToolTip="Click [...] to assign a deposit"></asp:Label> 
    <button style="width:22px; height:22px;" onclick="return OpenDeposit()">...</button> 
  </EditItemTemplate> 
  <ItemTemplate> 
     <asp:Label ID="lblDepositID" runat="server" Text='<%# Bind("DepositID") %>' Visible="false"></asp:Label> 
     <asp:Label ID="lblDepositNum" runat="server" Text='<%# Bind("DepositNum")%>'></asp:Label> 
   </ItemTemplate> 
</telerik:GridTemplateColumn> 

OpenDeposit() opens a RadWindow which allows them find and select an item.   The RadWindow returns a pair of parameters.  This all works great.  So now I would like to take those parameters and update the lblDepositID and lblDepositNum fields in the RadGrid for the row that is being edited.

I can find the Grid in the client side API.  I can get access to all of the rows or the "selected" rows.   But I can't figure out how to find the row that is in edit or insert mode, which is the only one I care about.  

So somehow in the client side javascript either I need to be able to store the row being edited when they go into edit mode so I can reference it later or find it after the window returns.

Any way of doing this?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Aug 2008, 08:10 AM
Hello Strela,

A suggestion would be to use the client object as an array to get the edited items index. In this way, you can get all the items in EditMode. Download the application towards the end of the link given below.
RadGrid Get EditedItems On Client

Princy.
0
Dave
Top achievements
Rank 2
answered on 29 Aug 2008, 03:32 AM
Princy:

That got me to the row that was being edited but I was then having a lot of trouble trying to access the controls in that row.  Never did figure out a way to do it.  If you can give me an example it would be appreciated, just for reference.   I could see the innerHtml, but not actually get the controls.

But I found this article while trying to figure it out:

http://www.telerik.com/community/code-library/submission/b311D-kmbgg.aspx

Using the GetGridServerElement(serverID, tagName)  technique found in this example I was able to both find the rows, get access to the controls, and update them.  Yeah!

Note that for some reason the register technique in the same example did not work though. The javascript to register in the edit template didn't seem to actually fire.   It would complain at compile time if I tried to bind invalid controls, but at runtime it would simply do nothing.   But the alternative method works fine.

Tags
Grid
Asked by
Dave
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Dave
Top achievements
Rank 2
Share this question
or