Custom Toolbar for Detail Grids

4 posts, 0 answers
  1. kieran
    kieran avatar
    19 posts
    Member since:
    Jul 2006

    Posted 20 Jul 2009 Link to this post

    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.
  2. kieran
    kieran avatar
    19 posts
    Member since:
    Jul 2006

    Posted 21 Jul 2009 Link to this post

    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?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. kieran
    kieran avatar
    19 posts
    Member since:
    Jul 2006

    Posted 22 Jul 2009 Link to this post

    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.
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 23 Jul 2009 Link to this post

    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.
Back to Top