I have a radgrid hierarchy structure. When the user navigates to the third level and clicks on the parent tickmark on the grid, the RadGrid1_ItemCommand is fired and I can retrieve the parent "ProgramID".
But I need to pickup the parentID when the user clicks on the command-template button located just on top of the detail rows. I would like to get the value within a client-side function or server-side if that is easier??? (but cannot get that to work well). See attachment for a jpg of grid...
Thank you for you help with this request!
Client-Side code:
function openConfirmationWindowNEW(sender, args) {
var programID= parentItem.OwnerTableView.Items[sender.Item.ItemIndex].GetDataKeyValue("ProgramID");
radopen("Storyboard.aspx?carID=programID, "RadWindow2");
}
Server-Side Code:
console.write((string) sender.Item.OwnerTableView.Items[e.Item.ItemIndex].GetDataKeyValue("ProgramID").ToString());
The code works below but it needs it to work from within a client-side function....
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.Item.OwnerTableView.DataSourceID == "SqlDataSource3")
{
GridDataItem parentItem = (GridDataItem)(e.Item.OwnerTableView.ParentItem);
if (parentItem != null)
{
//..tier 2 parent
Console.Write(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["StrategicInitID"]);
//..tier 3 parent
HiddenProgramIDSelected.Value = (string)e.Item.OwnerTableView.Items[e.Item.ItemIndex].GetDataKeyValue("ProgramID").ToString();
}
}
}