Hi All,
Always I need to display the first column data available in the selectec cell's row in a Label using Java Script..
Regards,
Abhi
Do you mean the "active cell", as in the cell that has input focus? Or do you instead actually mean a "selected cell", of which there may be more than one, such as by highlighting multiple cells at once?
I'm going to write the below JavaScript with the assumption you mean the "active cell," since WebGrid either has one active cell or none at all. I'm also assuming that you're not hiding any columns or allowing them to be re-ordered on the client, so that the first column displayed has an index of 0. Lastly, I'm using an alert() dialog to show the data.
Also note that I don't have a development environment on-hand at the moment, so I haven't tested this.
var grid = igtbl_getGridbyId("UltraWebGrid1"); // replace with the ClientID of your WebGridvar cell = grid.getActiveCell();if (cell == null){ alert("There is no active cell.");}else{ var firstCellValue = cell.Row.getCell(0).getValue(); alert(firstCellValue);}