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

Iterate through RadGrid

2 Answers 918 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aron
Top achievements
Rank 2
Aron asked on 25 Aug 2008, 12:26 PM
Hello,
I have a RadGrid (q2 2008)
The first column is template column with a textbox.

I want to iterate through all the rows and get the value of the textbox and perform an database action. How do I setup the iteration?

thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 Aug 2008, 12:49 PM
Hi Aron,

You can try out the following code to loop through the items in the Grid.
aspx:
<telerik:GridTemplateColumn UniqueName="Name"
        <ItemTemplate> 
            <asp:TextBox ID="TextBox1" Text='<%#Bind("Name") %>' runat="server"></asp:TextBox> 
        </ItemTemplate> 
</telerik:GridTemplateColumn> 

cs:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.Items) 
        { 
            TextBox txtbx = (TextBox)item["Name"].FindControl("TextBox1"); 
            string strtxt = txtbx.Text; 
        } 
    } 

Thanks
Princy.

0
prat
Top achievements
Rank 1
answered on 04 Oct 2011, 04:50 AM
I have a radgrid with four textboxes in each row(item template), one being costtextbox.
There is also a textbox outside the radgrid. On the blur event of this textbox i want all the costtextboxes
in each row to be updated with the same value.

I have achieved this using code behind, but is it possible to use a jquery or js to do the same. I am stuck and have been struggling to find a solution for this one.
Tags
Grid
Asked by
Aron
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
prat
Top achievements
Rank 1
Share this question
or