TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dipti prasad
NA
76
39.2k
how to fill dropdown from database in jqgrid in mvc??
Dec 24 2014 7:57 AM
Hello Friends,
Please help me in jqgrid.
how to add dynamic dropdownlist in jqgrid in add dilogue box ??
my code is working like in controller my data is come from database but not display in dropdownlist.
My View ....................
{
name: "Per", index: 'Code', align: "right", sortable: true, editable: true, edittype: 'select', editrules: { required: true }, formoptions: { rowpos: 5, colpos: 2 },
editoptions: {
dataUrl: '/Sales/Category'
, buildSelect: function (response) {
var data = typeof response === "string" ? $.parseJSON(response.responseText) : response;
var s = "<select>";
s += '<option value="0"></option>';
$.each(data, function () {
s += '<option value="' + data.Code + '">' + data.Name + '</option>';
})
return s + '</select>';
}
}, editrules: { required: true }
},// multiple: true,
....................................................................................................................................................
My Controller code
public JsonResult Category()
{
TFAT_WEBERPEntities ctx = new TFAT_WEBERPEntities();
List<string> listSelectListItems = new List<string>();
var company = from name in ctx.TfatComps select name.Name;
listSelectListItems.AddRange(company.Distinct());
ViewData["Per"] = new SelectList(listSelectListItems);
return Json(listSelectListItems, JsonRequestBehavior.AllowGet);
// return View();
}
Reply
Answers (
3
)
Object reference not set to an instance of an object.
how to login with youtube in asp.net and get video list