Click here to Skip to main content
15,887,485 members
Home / Discussions / ASP.NET
   

ASP.NET

 
SuggestionRe: Telerik version upgradation issue in Asp.net Pin
Richard Deeming12-May-17 4:08
mveRichard Deeming12-May-17 4:08 
QuestionGetting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14311-May-17 8:56
indian14311-May-17 8:56 
SuggestionRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
ZurdoDev11-May-17 9:15
professionalZurdoDev11-May-17 9:15 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14311-May-17 11:20
indian14311-May-17 11:20 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
ZurdoDev12-May-17 0:46
professionalZurdoDev12-May-17 0:46 
SuggestionRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming12-May-17 1:19
mveRichard Deeming12-May-17 1:19 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 7:16
indian14317-May-17 7:16 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming17-May-17 7:30
mveRichard Deeming17-May-17 7:30 
As I said, it's much easier to consume the original entities from script, rather than trying to convert the entities to a DataSet on the server, and then having to jump through hoops to consume the data from script.
C#
public object Get()
{
    using (AppDevSecEntities ctx = new AppDevSecEntities())
    {
        return new
        {
            Departments = (from c in ctx.Departments orderby c.DepartmentName select c).ToList(),
            FunctionalCategories = (from c in ctx.FunctionalCatagories orderby c.FunctionalCatagoryName select c).ToList(),
            BusinessUnits = (from c in ctx.BusinessUnits orderby c.BusinessUnitName select c).ToList(),
            Locations = (from c in ctx.Locations orderby c.LocationName select c).ToList(),
        };
    }
}

JavaScript
$.get("api/controller/Get").then(function(data){
    
    var list = $("#Department");
    var selectedValue = list.val();
    
    list.empty();
    $.each(data.Departments, function(index, department){
        $("<option>").attr("value", department.ID).text(department.DepartmentName).appendTo(list);
    });
    
    list.val(selectedValue);
});




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 10:39
indian14317-May-17 10:39 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming17-May-17 11:23
mveRichard Deeming17-May-17 11:23 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 12:14
indian14317-May-17 12:14 
Questionhow can i add gridview in asp.net page using c# Pin
Joker87AHAHAH10-May-17 7:26
Joker87AHAHAH10-May-17 7:26 
AnswerRe: how can i add gridview in asp.net page using c# Pin
User 418025414-May-17 19:04
User 418025414-May-17 19:04 
Questionpage doesnot autopostback on radio button Pin
prog.sidra10-May-17 2:25
prog.sidra10-May-17 2:25 
AnswerRe: page doesnot autopostback on radio button Pin
User 418025414-May-17 19:07
User 418025414-May-17 19:07 
AnswerRe: page doesnot autopostback on radio button Pin
senthilaaru18-May-17 4:34
senthilaaru18-May-17 4:34 
Questionasp .net and angular2 Pin
Member 121448819-May-17 19:59
Member 121448819-May-17 19:59 
AnswerRe: asp .net and angular2 Pin
Richard MacCutchan9-May-17 21:32
mveRichard MacCutchan9-May-17 21:32 
GeneralRe: asp .net and angular2 Pin
Member 1214488110-May-17 5:03
Member 1214488110-May-17 5:03 
GeneralRe: asp .net and angular2 Pin
Richard MacCutchan10-May-17 5:24
mveRichard MacCutchan10-May-17 5:24 
AnswerRe: asp .net and angular2 Pin
Afzaal Ahmad Zeeshan10-May-17 5:27
professionalAfzaal Ahmad Zeeshan10-May-17 5:27 
QuestionLuck with integrating lightSlider with bootstrap and MVC Pin
jkirkerx9-May-17 8:52
professionaljkirkerx9-May-17 8:52 
AnswerBetter Luck Now Pin
jkirkerx9-May-17 13:38
professionaljkirkerx9-May-17 13:38 
Questionsearch record in gridview on page change reset to the old Pin
prog.sidra9-May-17 1:06
prog.sidra9-May-17 1:06 
AnswerRe: search record in gridview on page change reset to the old Pin
Afzaal Ahmad Zeeshan9-May-17 1:19
professionalAfzaal Ahmad Zeeshan9-May-17 1:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.