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

How to get item in 2 hierarchy radgrid? (javascript)

4 Answers 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saint
Top achievements
Rank 1
Saint asked on 25 Jun 2008, 04:13 AM
Hi,

I want to get the checkbox item in 2 hierarchy radgrid.
For example:
I need to read step by step to reach the item:
1st mastertable->2nd detailtable -> item

------------------------------------
MasterTable
    -> DetailTable1
        ->item1
        ->item2
    -> DetailTable2
        ->item1
        ->item2

I was try with this code:
var checkbox = sender.get_detailTables()[i].get_element().getElementByTagName("INPUT")[j];

but this is only return the 1st 2 items in DetailTable1.

I was try also with this code, but it is a wrong syntax:
var checkbox = sender.get_masterTableView().get_dataItem()[args.get_itemIndexHierarchical()].get_detailTables()[i].get_element().getElementByTagName("INPUT")[j];


Please help me.

4 Answers, 1 is accepted

Sort by
0
Saint
Top achievements
Rank 1
answered on 26 Jun 2008, 01:10 AM
Hi,

Is there anyone can help me?
Thank you.
0
Yavor
Telerik team
answered on 30 Jun 2008, 07:07 AM
Hi Saint,

You can use the getcellbycolumnuniquename method to access a specified cell, and subsequently the control nested in it.
Let me know if this information helps.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mikael
Top achievements
Rank 1
answered on 30 Jun 2008, 09:03 AM
protected void Page_Load(object sender, EventArgs e) 
    { 
        if (Request["staff_id"] != null
        { 
            Page.Title = "Details for Customer ID: " + Request["staff_id"]; 
            SqlDataSource1.SelectParameters["staff_id"].DefaultValue = Request["staff_id"]; 
 
       
          
        } 
    } 
im having the same problem but cannot find the cell or staff_id i need. This cell is visible=false and therefore maybe not can be found with ".innerHTML" ? how do i access the id of the row of the next ownertable within the radgridmastertable???

this is working in C# in default.aspx to create a linkbutton and accessing a new radwindow: (note that i access a grid within the grid with name "contracts" )

protected void radgridVisaKontrakt_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ("Contracts".Equals(e.Item.OwnerTableView.Name)) 
        { 
            if (e.Item is GridDataItem) 
            { 
                HyperLink editLink = (HyperLink)e.Item.FindControl("VisaLink"); 
                editLink.Attributes["href"] = "#"
                editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["staff_id"]); 
            } 
        } 
    } 

this is the code in default.aspx for triggering java to show the window:

function ShowEditForm(id) 
            { 
 
                var grid = $find("<%= radgridVisaKontrakt.ClientID %>"); 
                 
                var rowControl = grid.MasterTableView.Rows[rowIndex].Control; 
                grid.MasterTableView.SelectRow(rowControl, true); 
                         
                window.radopen("ShowContract.aspx?staff_id=" + id, "UserListDialog"); 
                return false
            } 

And this is the code recieveing the staff_id in the file ShowContracts.aspx which has the code for the radwindow:

please help. I cannot get the staff_id into the radwindow.
0
Yavor
Telerik team
answered on 03 Jul 2008, 08:11 AM
Hello Mikael,

If the cell is not visible, its value would not be accessible. Another option would be to hide it with display:none, in which case it would not be visible, but its value would still be available.
Let me know if this helps.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Saint
Top achievements
Rank 1
Answers by
Saint
Top achievements
Rank 1
Yavor
Telerik team
Mikael
Top achievements
Rank 1
Share this question
or