How to get PanelBar to submit the form with a parameter

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 21 Sep 2012 Link to this post

    I thought i would use the PanelBar because it looks good.
    But can't find any real info on how to actually use it.

    I need it to set a parameter in my model and then to submit the form/page.

    I used to use a bunch of radio buttons like this:
    @foreach(var item in Model.Years)
            <div class="YearRadio">
                @Html.RadioButtonFor(x => x.CurrentYear, item.Id.ToString(),new { onchange = "this.form.submit();" })

    And thought i would replace them with a nice panelbar something like this:

                .Items(panelbar =>
                        .Items(africa => {
                            foreach (var item in Model.Years)
    I found an action method on the panel bat, but it is unclear how to get it to simply action the default action. Also, don't know hot to bind or send the information to my model. Perhaps i could pass it to my controller as a variable or something.
  2. Dimo
    Dimo avatar
    8318 posts

    Posted 26 Sep 2012 Link to this post

    Hi Andrew,

    The PanelBar cannot submit information about its selected item, because it does not contain form elements and fields. You can use the widget's select event and populate a hidden field outside the PanelBar. Note that this approach does not boast the greatest possible accessibility, as it relies on both Javascript and CSS.

    You can make a PanelBar item call an action method on click by specifying the item's Url() or Action() or Route(). This will make the item render a hyperlink.

    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top