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

[Solved] Panelbar in grid column is wired up to menu in other column - how?

3 Answers 34 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob
Top achievements
Rank 1
Rob asked on 29 Nov 2011, 06:55 PM
Hi,

I have a Telerik MVC grid that has a column with a menu in it as well as a column with a panel bar in it.  I recently added the panel bar to one of the columns and now when I click on items in the panel bar, the "onSelect" javascript function for the menu is executing -- and it is executing once for each row (for each panel bar).  How does this happen?

Below is the code that defines both of the conflicting columns and I don't see how the menu jscript function is being bound to the panelbar.  Any insight is appreciated.

Thanks,

Rob

--

Here is how I defined my menu:
columns.Bound(o => o.Status)
    .ClientTemplate(Html.Telerik().Menu().Name("menuOrderStatus_<#=OrderId#>")
        .Items(menu => menu.Add().Text("<#=Status#>").HtmlAttributes(new { @style = "width:115px;", @class = "orderlist-current-order-status" })
            .Items(submenu =>
            {
                IList<string> orderStatuses = ViewData["AllOrderStatuses"] as IList<string>;
                foreach (string status in orderStatuses)
                    submenu.Add().Text(status).HtmlAttributes(new { @style = "width:115px;" });
            }))
     .ClientEvents(events => events.OnSelect("menuSelectOrderStatus").OnOpen("menuOpenOrderStatus").OnClose("menuClosed"))
     .Effects(fx =>
         fx.Expand(animation => animation.CloseDuration(AnimationDuration.Fast).OpenDuration(AnimationDuration.Fast))
             .OpenDuration(AnimationDuration.Fast).CloseDuration(AnimationDuration.Fast))
     .ToHtmlString());

Here is how I defined my panelbar: 
columns.Bound(o => o.HasPhone)
.Title("Phone")
.ClientTemplate(Html.Telerik().PanelBar()
.Name("panelPhone_<#=OrderId#>")
.SelectedIndex(0)
.Items(item => { item.Add()
        .Text("Phone")
        .Expanded(false)
        .ImageUrl("~/images/icons/16/phone.png")
        .ImageHtmlAttributes(new { alt = "Patient Phone Numbers" })
        .Items(subItem =>
        {
            subItem.Add().Text("(h) <#=PatientHomePhone#>");
            subItem.Add().Text("(c) <#=PatientCellPhone#>");
            subItem.Add().Text("(w) <#=PatientWorkPhone#>");
        });
}).ToHtmlString());

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 02 Dec 2011, 04:41 PM
Hello Rob,

I implemented the scenario you described but I did not encounter the same behavior. Could you please check if I missed something in the sample I attached? If so please modify the project and send it back so we can check it.

Kind regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Rob
Top achievements
Rank 1
answered on 02 Dec 2011, 05:21 PM
Hi Petur,

Thanks for the assistance.  Would you be able to send me the project in VS 2008 format?  Unfortunately, I don't have 2010 at the moment.

Thanks,

Rob
0
Petur Subev
Telerik team
answered on 05 Dec 2011, 02:19 PM
Hi Rob,

Here is the converted VS2008 solution.

Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
PanelBar
Asked by
Rob
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Rob
Top achievements
Rank 1
Share this question
or