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

[Solved] Access DropDownList Selected Value in TabStrip LoadContentFrom??

0 Answers 33 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 20 Jul 2011, 03:54 PM
I have a project that is using a Telerik DropDownList for the years, and a TabStrip to display a grid for each month.  This is a scheduling system that lists the item on the left of the grid, and the days for scheduling across the top.  The issue I am having is getting the value of the DropDownList which is the user selected year, and passing that into my partial view that loads the grid into each tab.  Below is my TabStrip and DropDownList.  I am using razor.  I need to set the year parameter that is passed to my controller for the partial view to the selected value in the LoadContentFrom().  Any help or another way to get this to work is greatly appreciated.  On a side note, I am fairly new to MVC, Razor, and Telerik controls.

@(Html.Telerik().DropDownList()
                            .Name("YearsDDL")
                            .ClientEvents(events => events
                                .OnChange("dropDownListChange"))                                                               
                            .HtmlAttributes(new { style = "float: left;" } )                         
                            .Items(item =>
                            {
                                item.Add().Text((DateTime.Now.Year - 1).ToString()).Value((DateTime.Now.Year - 1).ToString()).Selected(Model == null ? false : Model.SelectedYear == DateTime.Now.Year - 1);
                                item.Add().Text((DateTime.Now.Year).ToString()).Value((DateTime.Now.Year).ToString()).Selected(Model == null ? true : Model.SelectedYear == DateTime.Now.Year);
                                item.Add().Text((DateTime.Now.Year + 1).ToString()).Value((DateTime.Now.Year + 1).ToString()).Selected(Model == null ? false : Model.SelectedYear == DateTime.Now.Year + 1);
                            }))

And here is my TabStrip.....

@{ Html.Telerik().TabStrip()
                               .Name("myTabs")
                               .SelectedIndex(DateTime.Now.Month - 1)
                               .ClientEvents(events => events
                                   .OnLoad("GetSelectedYear()")
                                   )
                               .Items(tabstrip =>
                                   {
                                       for (int i = 0; i < 12; i++)
                                       {
                                           tabstrip.Add()
                                               .Text(Model.Months[i])
                                               .LoadContentFrom("MaintenanceGridPartial", "ScheduledMaintenance", new { @month = i + 1, @year = ???? }); 
                                        }
                                   })
                                   .Render();
              }


Thanks in advance for any help with this.  It is probably something easy that I am just not finding online or overlooking.
Tags
ComboBox
Asked by
Chris
Top achievements
Rank 1
Share this question
or