Hi,
I want to call a client side script inside an ItemTemplate.
The function accepts 2 parameters, the ID and the index of the row.
I trigger all this by setting:
As you can see, the second parameter is missing. I am inside a hira. Table. I want to get the index of the parent table inside the DataBinder. Is there a way to get the value?
Another solution I am searching for ist to get the current selected row via client API without eventargs.
In detail I just want to collapse the parent row and open a radwindows (which works already) when the button inside the template is clicked. Maybe you have another idea.
Thanks!
Chris
I want to call a client side script inside an ItemTemplate.
The function accepts 2 parameters, the ID and the index of the row.
I trigger all this by setting:
<ItemTemplate> |
<div style="background-color:Gray; padding:5px"> <a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"ID")%>'); return false;">Test</a> |
</div> |
</ItemTemplate> |
As you can see, the second parameter is missing. I am inside a hira. Table. I want to get the index of the parent table inside the DataBinder. Is there a way to get the value?
Another solution I am searching for ist to get the current selected row via client API without eventargs.
In detail I just want to collapse the parent row and open a radwindows (which works already) when the button inside the template is clicked. Maybe you have another idea.
Thanks!
Chris
5 Answers, 1 is accepted
0
Hello Christian,
You can get the value for the parent item cell in the data binder in the following way:
If you need to collapse a RadGrid row before opening a RadWindow, you can attach to the client-side OnClientShow event handler of the RadWindowManager, and there collapse all RadGrid expanded items:
Sincerely yours,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can get the value for the parent item cell in the data binder in the following way:
<%# DataBinder.Eval(Container.OwnerTableView.ParentItem.DataItem, "ProductID")%> |
If you need to collapse a RadGrid row before opening a RadWindow, you can attach to the client-side OnClientShow event handler of the RadWindowManager, and there collapse all RadGrid expanded items:
function WindowShow(sender, args) |
{ |
var dataItems = $find('RadGrid1').get_masterTableView().get_dataItems(); |
for (var i=0; i< dataItems.length; i++) |
{ |
dataItems[i].set_expanded(false); |
} |
} |
Sincerely yours,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Christian
Top achievements
Rank 1
answered on 03 Jul 2008, 10:28 AM
Hi,
I want to get the row ID / INDEX of the parent row, not a dataitem value via databinder.
Thanks,
Chris
I want to get the row ID / INDEX of the parent row, not a dataitem value via databinder.
Thanks,
Chris
0
Hi Christian,
In this case you can replace the mentioned inline expression with the following:
or
Kind regards,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
In this case you can replace the mentioned inline expression with the following:
<%# DataBinder.Eval(Container.OwnerTableView.ParentItem, "ItemIndex") %> |
or
<%# Container.OwnerTableView.ParentItem.ItemIndex %> |
Kind regards,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Christian
Top achievements
Rank 1
answered on 05 Jul 2008, 12:45 PM
Hi,
dataItems[0].set_expanded(
false);
do not collapse the item !? I get a reference, but nothing happens.
If I use:
$find(
"<%= RadGrid1.MasterTableView.ClientID %>").collapseItem(0);
it collapse but the "+/-" image button still is set to "-" what means, the grid thinks it´s still expanded ?!
Are there any bugs in set_expanded?
0
Hello Christian,
The expand/collapse image does not automatically adjust when expanding or collapsing on the client. Here is a sample script to set the plus/minus image accordingly:
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The expand/collapse image does not automatically adjust when expanding or collapsing on the client. Here is a sample script to set the plus/minus image accordingly:
var item = sender.get_masterTableView().get_dataItems()[args.get_itemIndexHierarchical()]; |
var masterTableView = sender.get_masterTableView(); |
var rowIndex = args.get_itemIndexHierarchical(); |
if(!item.get_expanded()) |
{ |
var imageButtonPath = masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[rowIndex], "ExpandColumn").innerHTML; |
imageButtonPath = imageButtonPath.replace("title=\"Expand\" class=\"rgExpand\"","title=\"Collapse\" class=\"rgCollapse\""); |
masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[rowIndex], "ExpandColumn").innerHTML = imageButtonPath; |
} |
else |
{ |
var imageButtonPath = masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[rowIndex], "ExpandColumn").innerHTML; |
imageButtonPath = imageButtonPath.replace("title=\"Collapse\" class=\"rgCollapse\"","title=\"Expand\" class=\"rgExpand\""); |
masterTableView.getCellByColumnUniqueName(masterTableView.get_dataItems()[rowIndex], "ExpandColumn").innerHTML = imageButtonPath; |
} |
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center