Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i am working with a simple page include jqgrid dropdownlist-(jqgrid-mvc)
when i wanted to use it in my page
it does not appear correctly in my page .(IE 10 - Chrome)

this is my code
View Code ::

@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>
Posted
Comments
Suvendu Shekhar Giri 1-Apr-15 5:42am    
What's is the issue? It's not clear from the question. Share little more info about the issue.
mahmoodof 1-Apr-15 7:01am    
please look at this linK:
http://www.axgig.com/images/14716278308382422042.png
mahmoodof 1-Apr-15 6:26am    
hello
i am sorry.
dropdownlist does not appear truely.it does not show truely.
it is shown like this:
photo-Chorome
mahmoodof 1-Apr-15 6:36am    
please look at this linK:
Link
ramyajaya 2-Apr-15 4:14am    
Hai

I saw a minor mistake in your view I want you to correct it.

Your begin form is inside head tag but end form is in body tag so your html becomes a mess

Please do this change and check your code further

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900