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

Custom Toolbar for Detail Grids

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kieran
Top achievements
Rank 1
kieran asked on 20 Jul 2009, 06:29 PM
Hi.

I am trying to have a set of controls at the foot of every detail grid. These controls are not paging controls or edit controls, but I am using a Pager Template to place them where I want them. The result is something like this:
Outer Row 
   Inner Row 
   Inner Row 
   Inner Row 
      [list box] [button] 
Outer Row 
   Inner Row 
   Inner Row 
      [list box] [button] 
 
My problem is that the contents of the list box should be different for each inner grid and I don't know how to get at the control or it's construction to do that.

Is there a way to do this? Or am I looking in entirely the wrong direction?

Thanks.

3 Answers, 1 is accepted

Sort by
0
kieran
Top achievements
Rank 1
answered on 21 Jul 2009, 04:00 PM
OK. I see now I should be using a CommandItem template.

I still have a problem though. Aswers elsewhere indicate that I should be setting the state of my control (in this case populating my list box) in the OnPreInit handler. I set this on the detail table, but it never seems to fire.

My real problem is that the contents of the list box depends on a value in the current outer row.

Any suggestions?
0
kieran
Top achievements
Rank 1
answered on 22 Jul 2009, 04:22 PM
I worked it out.

In a method bound to the OnItemCreated event of the master table, I query for the data key value and select based on that.

        if (e.Item is GridCommandItem) 
        { 
            GridItem commandItem = e.Item as GridCommandItem; 
            DropDownList events = (DropDownList) commandItem.FindControl("MyDropDownList"); 
 
            IRepository rep = RemoteServer.GetRepository(); 
            string id = commandItem.OwnerTableView.DataKeyValues[0]["ID"].ToString(); 
            events.DataSource = rep.GetScheduledEventsFor(id); 
            events.DataTextField = "Date"
            events.DataValueField = "ID"
         } 

I don't know what one would do if the value you wanted wasn't a key column.
0
Iana Tsolova
Telerik team
answered on 23 Jul 2009, 10:30 AM
Hi kieran,

You can refer to this help topic for more information on accessing RadGrid cells and rows.
Let me know if further questions arise.

Regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
kieran
Top achievements
Rank 1
Answers by
kieran
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or