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

HightLight Row of Grid

4 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dip
Top achievements
Rank 1
Dip asked on 02 Nov 2008, 06:53 PM
I have to run a javascript function on window Load..In the same function I planed to select a default for on the Grid..I have to do it on the client side...

Javascript

window.onload :function()
{
    RowHightLight();
}
RowHightLight()
{
    Var RadGrid=$find("<%=RadGrid1.ClientID%>");
    (Object created sucessful ...NOW WHAT !!!??)

}

When I looked at the Forum and Documentation I see
$find("<%=RadGrid1.ClientID%>").get_masterTableView()..get_dataItem()[2].set_selected(true);
But the problem is that I don't get any methods like get_masterTableView()...

Please help..

Thansk,
DIP

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Nov 2008, 10:18 AM
Hello Dip,

It depends on the version you used:

RadControls for ASP.NET AJAX:
var radGrid = $find("<%=RadGrid1.ClientID%>"); 
radGrid.get_masterTableView().get_dataItems()[0].set_selected(true); 

RadControls for ASP.NET:
var radGrid = window["<%=RadGrid1.ClientID%>"]; 
radGrid.MasterTableView.Rows[0].SetSelected(truefalse); 

Additionally I want to suggest you use Page Load as shown below.
function pageLoad() 
{ RowHightLight();

I hope this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dip
Top achievements
Rank 1
answered on 03 Nov 2008, 02:07 PM
It is a Ajax Asp.net ...
If I do
 var radGrid = $find("<%=RadGrid1.ClientID%>"); 
it says Undefined...

var radGrid = document.getElementById("<%=RadGrid1.ClientID%>"); 
Radgrid object is created but I can't highLight the row
0
Daniel
Telerik team
answered on 03 Nov 2008, 02:24 PM
Hello Dip,

Please test the following approach:

aspx (RadGrid declaration)
<ClientSettings ClientEvents-OnGridCreated="GridCreated" /> 

javascript
<script language="javascript" type="text/javascript"
    var radGrid; 
    function GridCreated(sender, args) 
    { 
        radGrid = sender; 
    } 
     
    function RowHightLight() 
    { 
        radGrid.get_masterTableView()... 
        ... 
    } 
</script> 

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
joan
Top achievements
Rank 1
answered on 25 Feb 2009, 07:38 PM
Hi,
In my application, when edit a row, it opens a window with ShowEditForm as below:

function

 

ShowEditForm(id, rowIndex) {

 

 

var grid = $find("<%= RadGrid1.ClientID %>");

 

 

var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();

 

grid.get_masterTableView().selectItem(rowControl,

true);  //What does this line do?  I want to high light the row.

 

window.radopen(

"ScheduleA.aspx?index=" + rowIndex, "ScheduleAWindow");

 

 

return false;

 

}

Can you help with where I put comments?  I experimented with the code posted here with no success. It would be nice to high light the row during edit operation.   The application uses RadControls Asp.netAjax, 2008 Q3 version.

thanks.

Tags
Grid
Asked by
Dip
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dip
Top achievements
Rank 1
joan
Top achievements
Rank 1
Share this question
or