@using Trirand.Web.Mvc @model dynamic @{ ViewBag.Title = "title"; } <h2>title</h2> <!DOCTYPE html> <html lang="en-us"> <head id="Head1" runat="server"> <meta charset="utf-8"> <title>jqDropDownList for ASP.NET MVC - Selection</title> <!-- The jQuery UI theme that will be used by jqDropDownList --> <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/themes/redmond/jquery-ui.css" /> <!-- The jQuery UI theme extension jqDropDownList needs --> <link rel="stylesheet" type="text/css" href="../../Content/trirandcss/ui.jqdropdownlist.css" /> <!-- jQuery runtime minified --> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-2.0.3.min.js" type="text/javascript"></script> <!-- The jqDropDownList client-side javascript --> <script type="text/javascript" src="../../Scripts/trirand/jquery.jqDropDownList.min.js"></script> <style type="text/css"> body, html { font-size: 80%; } </style> @Html.BeginForm("Selection", "DropDownList") </head> <body> @Html.Trirand().JQDropDownList( new JQDropDownList { Height = 90, Width = 150, Items = ViewData["items"] as List<jqlistitem> }, "dropdownlist") <br /> <br /> @if ( @ViewData["message"] != null && @ViewData["message"].ToString().Length > 0) { "font-size: 120%; font-family: Tahoma">@ViewData["message"] } <br /> <br /> <input type="button" id="showSelectedItemButton" value="Show Selected Item" /> @{Html.EndForm();} <br /> <br /> <br /> <br /> <br /> <br /> </body> </html> my controller code <pre> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Trirand.Web.Mvc; namespace JqGridModelFist.Controllers { public class DropDownListController : Controller { public ActionResult DropDownListDemo() { return View(); } public ActionResult Selection(string DropDownList_selectedValue) { // load items and set selected one based on previsous selection // ViewData["items"] will be used in the View to populate the dropdown ViewData["items"] = GetItems(DropDownList_selectedValue); if (!String.IsNullOrEmpty(DropDownList_selectedValue)) { ViewData["message"] = "Selected Item: " + DropDownList_selectedValue; } return View(); } public List<jqlistitem> GetItems(string selectedValue) { var items = new List<jqlistitem> { new JQListItem { Text = "One", Value = "One", ImageUrl = "/content/images/folder.png" }, new JQListItem { Text = "Two", Value = "Two", ImageUrl = "/content/images/folder-open.png" }, new JQListItem { Text = "Three", Value = "Three", ImageUrl = "/content/images/document.png" } }; if (!String.IsNullOrEmpty(selectedValue)) { var item = items.Find(i => i.Value == selectedValue); if (item != null) item.Selected = true; } return items; } //[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ public ActionResult TextOnly(int? toggleImage, int? dropDownWidth) { ViewData["standard"] = ViewData["triangle"] = ViewData["mac"] = ViewData["carat"] = false; ViewData["width75"] = ViewData["width150"] = ViewData["width300"] = false; if (toggleImage == null) toggleImage = 1; if (toggleImage == 1) { ViewData["standard"] = true; ViewData["image"] = "ui-icon-triangle-1-s"; } if (toggleImage == 2) { ViewData["triangle"] = true; ViewData["image"] = "ui-icon-circle-triangle-s"; } if (toggleImage == 3) { ViewData["mac"] = true; ViewData["image"] = "ui-icon-triangle-2-n-s"; } if (toggleImage == 4) { ViewData["carat"] = true; ViewData["image"] = "ui-icon-carat-1-s"; } if (dropDownWidth == null) dropDownWidth = 2; if (dropDownWidth == 1) { ViewData["width75"] = true; ViewData["dropDownWidth"] = 75; } if (dropDownWidth == 2) { ViewData["dropDownWidth"] = 150; ViewData["width150"] = true; } if (dropDownWidth == 3) { ViewData["width300"] = true; ViewData["dropDownWidth"] = 300; } return View(); } } } and it has been shown in my browser. <a href="http://www.axgig.com/images/83816767606399841127.png">photo-Chorome</a> how should i modify my code. thankyou.</jqlistitem></jqlistitem>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)