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

RadGrid cell value in a TextBox

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Quique
Top achievements
Rank 1
Quique asked on 22 Oct 2008, 10:13 PM
Hi folks!

I'm trying to pass a value from a RadGrid's cell to a TextBox. I'm using C# and when I select a row of the grid I pass the value to the text box with the next code:

var curRow = grid.MasterTableView.GetCellByColumnUniqueName(gri d.MasterTableView.SelectedRows[i], "nombre");
document.getElementById("txtNombre").setAttribute( 'value',curRow.innerHTML);


This code runs ok; the problem arrives when I try read the TextBox value; if I write txtNombre.text the program doesn't read the data, if I use txtNombre.value obtain a compiler error.

Please, how can I read the textbox value???

Thank a lot!!!

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Oct 2008, 08:37 AM
Hello Quique,

Please test the code below:

RadControls for ASP.NET AJAX:
function buttonClick() 
    var radGrid = $find('<%= RadGrid1.ClientID %>'); 
    var textBox = $get("TextBox1"); 
 
    var cellElement = radGrid.get_masterTableView().getCellByColumnUniqueName(radGrid.get_masterTableView().get_selectedItems()[0], "OrderID"); 
    textBox.innerText = cellElement.innerHTML

RadControls for ASP.NET
function buttonClick2() 
    var radGrid = window["<%= RadGrid2.ClientID %>"]; 
    var textBox = document.getElementById("TextBox2"); 
 
    var cellElement = radGrid.MasterTableView.GetCellByColumnUniqueName(radGrid.MasterTableView.SelectedRows[0], "OrderID"); 
    textBox.innerText = cellElement.innerHTML

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Quique
Top achievements
Rank 1
answered on 23 Oct 2008, 09:12 PM
Thanks a lot.

The code runs ok.

Good luck!!!!
Tags
Grid
Asked by
Quique
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Quique
Top achievements
Rank 1
Share this question
or