So I have a model

public class test
{
    private List<int> _abc;

    public List<int> abc
    {
        get { return _abc; }
        set { _abc = value; }
    }
}

My partial page:

@model List<int>

//do something with model

My main page :

@model somenamespace.test

@Html.Partial("~/Views/Test/partial.cshtml", model.abc)

But I got this error when trying to access the page :

The model item passed into the dictionary is of type , but this dictionary requires a model item of type 'System.Collections.Generic.List`1[System.Int32]'.

I'm confused because my partial view accept list of integer and I pass property with list of integer as datatype, anything wrong with my code?

Any help will be appreciated and sorry for bad english.

So I am writing an angular front end app for an enterprise client and my file structure is as such:

- App (root)
  - Assets
    - CSS
    - JS (plugins, libraries, etc)
    - Images
    - Fonts
  - Common
    - Header
      -header.html
    - Sidebar, etc
  - Modules
    - HR
      - HR.module.js (the module, for this module, yeah kinda confusing)
      - HR.routes.js (the routes for this module)
      - Employees
        - EmployeesController.js (the controller for this specific peice of thsis module)
        - EmployeesRepository.js (the factory/service for this app)

So far this has worked out alright (though tips are welcome) the issue i am running into is, if I have two modules (let's say HR and IT) then my main index page needs to utilize the routes from both, but you can only have one angular module per page. I could put all routes in a common app.js file, but that kind of messes with my seperation layout. Is there a solution to this? Or should I use a more elegant file sctructure?

Edit1 - routing

var hrModule = angular.module("hrModule", ['ngRoute', 'ngResource'])
    .config(function ($routeProvider, $locationProvider) {
        $routeProvider.when('/HR/Employees', { templateUrl: '/Modules/HR/Employees/Employees.html', controller: 'EmployeesController' });
        $locationProvider.html5Mode(true);
    });

I have an issue with grabbing facebook user details from my MVC web application. I want to grab the age_range value (which is public value and is included public_profile) or the user_birthday value, which is giving it's value only to the app administrator.

var x = new FacebookAuthenticationOptions();
            x.Scope.Add("user_birthday");
            x.Scope.Add("email");
            x.Scope.Add("public_profile");
            x.Scope.Add("user_friends");
            x.Scope.Add("age_range");

            x.AppId = "....";
            x.AppSecret = "....";
            x.Provider = new FacebookAuthenticationProvider()
            {
                OnAuthenticated = async context =>
                {
                    context.Identity.AddClaim(new System.Security.Claims.Claim("FacebookAccessToken", context.AccessToken));
                    foreach (var claim in context.User)
                    {
                        var claimType = string.Format("urn:facebook:{0}", claim.Key);
                        string claimValue = claim.Value.ToString();
                        if (!context.Identity.HasClaim(claimType, claimValue))
                            context.Identity.AddClaim(new System.Security.Claims.Claim(claimType, claimValue, "XmlSchemaString", "Facebook"));
                    }
                }
            };

            x.SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie;
            app.UseFacebookAuthentication(x);

and another code chunk, which is grabbing the values.

var firstNameClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:first_name");
                var lastNameClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:last_name");
                var DOBClaim = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:birthday");
                var ageRange = info.ExternalIdentity.Claims.First(c => c.Type == "urn:facebook:age_range");

So can anyone help me to grab the user age_range value ??

Figure1: Here's an example Model class

class Games {
    public $id = 0;
    public $date = null;
    public $player1_id = 0;
    public $player2_id = 0;
    public $score = null;

    public function save(){
        if(empty($this->id)){
            // do INSERT here
        }
        else{
            // do UPDATE here  
        }
    }
}

Figure2: Here's an example use of the class

// Save a new date to an existing game
$game = new Games;
$game->id = $input['id'];
$game->date = $input['date'];
$game->save();

If an UPDATE query is performed based on figure2, then the values for player1_id, player2_id, and score will be incorrectly overwritten to zeros/nulls. Therefore, I need a way to determine from inside the class that certain properties were not set from the call in figure2, so I can dynamically alter the UPDATE query to only update specific fields in the database. Or am I approaching this wrong?

Note: I know I could use a single array property to hold all the fields (and use isset), but this feels like it's breaking the point of the Model and would also be very PHP specific (in that the solution doesn't transfer nicely to other languages such as JAVA where arrays are strictly typed?). I also realize I could do what I think ORMs do and make an initial SELECT query before I perform an update (but that seems very inefficient!)

My Database table looks like this (rough outline):

    +--------+-----------+-------------+---------+------------+------------+
    | log_id | host_name |   status    | host_id | profile_id | event_date |
    +--------+-----------+-------------+---------+------------+------------+
    |   1    |   site1   |   Online    |    2    |    1       |  <*date*>  |
    +--------+-----------+-------------+---------+------------+------------+
    |   2    |   site1   |   Online    |    2    |    1       |  <*date*>  |
    +--------+-----------+-------------+---------+------------+------------+
    |   3    |   site1   |   Offline   |    2    |    1       |  <*date*>  |
    +--------+-----------+-------------+---------+------------+------------+
    |   4    |   site2   |   Online    |    4    |    1       |  <*date*>  |
    +--------+-----------+-------------+---------+------------+------------+ 
    |   5    |   site2   | Maintenance |    4    |    1       |  <*date*>  |
    +--------+-----------+-------------+---------+------------+------------+

Here are my codes:

VIEW:
<?php foreach($result as $row): ?> 
  ['<?php echo $row->host_name;?>',<?php echo $this->help_model->filter_online($id,$row->host_id, 'Online');?>,
  <?php echo $this->help_model->filter_online($id,$row->host_id, 'Offline');?>,
  <?php echo $this->help_model->filter_online($id,$row->host_id,'Maintenance');?>],
 <?php endforeach; ?> 

CONTROLLER:
public function userreports()
    {       
        $data['id']=$this->session->userdata('profile_id');
        $this->session->set_userdata('from_date', '2015-01-01');
        $from_date = $this->session->userdata('from_date');
        $date = date('Y-m-d',now());
        $this->session->set_userdata('to_date', $date);
        $to_date = $this->session->userdata('to_date');
        $data['result'] = $this->help_model->all_logs($this->session->userdata('profile_id'));
        $this->load->view('squidtopus1-host-reports', $data);
    }

MODEL:
function all_logs($id)
    {
        $id = $this->session->userdata('profile_id');
        $this->db->select("*");
        $this->db->from('server_log');
        $this->db->where('profile_id',$id);
        $query = $this->db->get()->result();
        return $query;
    }

function filter_online($data, $host_id, $status)
    {
        $from_date = $this->session->userdata('from_date');
        $to_date = $this->session->userdata('to_date');
        $id = $this->session->userdata('profile_id');
        $this->db->select()->from('server_log');
        $this->db->where('profile_id',$id);
        $this->db->where('status',$status);
        $this->db->where('host_id',$host_id);
        $this->db->where('event_date >=',$from_date);
        $this->db->where('event_date <=',$to_date);
        $data =  $this->db->get()->result();
        $stat_count = 0;
        foreach ($data as $row) {
            $stat_count++;
        }

        return $stat_count;
    }

The information that needs to displayed is shown properly, but the problem is that it repeatedly shows it for each row in the database that matches 'profile_id = $id'(in this case, profile_id=1). Ideally it should show:

['site1', 2,1,0], ['site2', 1,0,1]

But instead it shows:

['site1', 2,1,0],['site1', 2,1,0],['site1', 2,1,0],['site2', 1,0,1],['site2', 1,0,1]

I can't determine where I've gone wrong... So any insight into solving this issue is greatly appreciated. Thanks ahead!

We are currently using the DotNet.Highcharts API to incorporate Highcharts into our website. However, we are having some JavaScript reference issues when using the .SetOptions(GlobalOptions) call.

We are using a wrapper class to build our chart in the controller, then using a simple view to render it.

In our controller:

Chart chart = new HighCharts("chart-id");
chart.SetOptions(new GlobalOptions { Global = new Global { UseUTC = false; } });
chart.SetPlotOptions()...

In our view:

@model HighchartWrapper

@(Model.Chart)

The chart is rendered in the view as follows:

<script type="text/javascript">
    Highcharts.setOptions({ global: { useUTC: false } });
    var chart05;
    $(document).ready(function() {
    });
</script>

Chrome is raising an "Uncaught ReferenceError: Highcharts is not defined" error on the .setOptions() statement. Without this (and the corresponding .SetOptions() statement in .NET) the chart renders correctly. If I navigate off this page and then back again, the charts start to render correctly.

Are there any ideas as to why the .SetOptions() statement isn't working? I think it is because it is outside the .ready() function, but that's just a guess.

Using Bootstrap in my Razor page, I am opening a modal window:

<div class="container-fluid">
    <div class="navbar navbar-fixed-top navbar-default">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="offcanvas" data-target=".navbar-offcanvas" data-canvas="body">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

            <a class="navbar-brand pull-right" href="#">
                <img src="assets/img/logo-header.png" alt="Alternate Text for Image">
            </a>
        </div>

        <div class="navbar-offcanvas offcanvas navmenu-fixed-left">
            <a class="navmenu-brand" href="#">eServices</a>
            <ul class="nav nav-justified">
                <li><a href="#" data-toggle="modal" data-target="#modalSignup" data-backdrop="static">New Here?</a></li>
                <li><a href="index.html">Services</a></li>
                <li><a href="#" data-toggle="modal" data-target="#modalLogin" data-backdrop="static">Sign In</a></li>
            </ul>
        </div>
   </div>
</div>

<div class="modal fade" id="modalLogin" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <p>
                    <h3 class="modal-title" id="myModalLabel">Login to MyApplication</h3>
                </p>
            </div>

                @using (Html.BeginForm("index", "home", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form", @class = "form-horizontal" }))
                {
                    @Html.AntiForgeryToken()
                    <div class="form-group @Html.ValidationErrorFor(m => m.Username, "has-error has-feedback")">
                        <div class="col-sm-12">
                            @Html.FormTextBoxFor(p => p.Username, new { @class = "form-control" })
                            @if (!Html.IsValid(m => m.Username))
                            {
                                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
                            }
                            @Html.ValidationMessageFor(m => m.Username, null, new { @class = "help-block" })
                        </div>
                    </div>
                    <div class="form-group @Html.ValidationErrorFor(m => m.Password, "has-error has-feedback")">
                        <div class="col-sm-12">
                            @Html.FormPasswordFor(p => p.Password, new { @class = "form-control" })
                            @if (!Html.IsValid(m => m.Password))
                            {
                                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
                            }
                            @Html.ValidationMessageFor(m => m.Password, null, new { @class = "help-block" })
                        </div>
                    </div>
                    @Html.ValidationSummary(true, string.Empty, new { @class = "test" }, "span")
                    <div class=" pull-right">
                        <p>
                            <button type="submit" class="btn btn-default">@Forms.ButtonSignin</button>
                        </p>
                        <br />
                        <p>
                            @Html.ActionLink("Forgot your username?", "ForgotUsername")
                        </p>
                        <p>
                            @Html.ActionLink("Forgot your password?", "ForgotPassword")
                        </p>
                    </div>
                }
        </div>
    </div>
</div>

The issue I have is that, for example, I entered an incorrect username/password combination, the form validates, but the modal window closes. Is there a way to re-open the modal window after the form has posted if the validation triggered an error?

Controller:

    public ActionResult Detail(string type, string eventid)
    {
        var model = new Entiteit();
        var model2 = new CatalogusView();
        List<EventItem> films = model2.film();
        List<EventItem> talkshows = model2.talkshow();
        List<EventItem> tentoostellingen = model2.tentoonstelling();
        if (type == "film")
        {
            EventItem Film = model.EntiteitItem(films, eventid);
            List<SelectListItem> items = new List<SelectListItem>();
            items.Add(new SelectListItem { Text = null, Value = null });
            foreach (Ticketitem ticket in Film.Eventtickets)
            {
                items.Add(new SelectListItem { Text = ticket.Ticketnaam + " €" + ticket.Ticketprijs.ToString(), Value = ticket.Ticketvariantid.ToString() });
            }
            ViewData["Tickets"] = items;
            ViewData["Event"] = Film;
        }

View:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    EventItem item = ViewBag.Event;
    List<SelectListItem> tickets = ViewBag.Tickets;
}
<title>Detail</title>
<div class="entiteit">
    @if (item == null)
    {
        <div>ERROR 404</div>
        <div>-Deze pagina is alleen te bereiken via een selectie in de catalogus, er is nu geen info.-</div>
    }
    else if (item.Eventtype == "film")
    {
        <div>Naam: @item.Eventname</div>
        <div>Beschrijving: @item.Eventdescription</div>
        <div>Datum: @item.Eventdate</div>
        <div><img src="~/Content/Images/Films/@item.EventlocationImagepath" alt="@item.Eventname" /></div>
        <div>Lengte: @item.Eventduur</div>
        <div>Locatie: @item.Eventlocation</div>
        <img src="~/Content/Images/Locations/@item.EventlocationImagepath" alt="@item.Eventlocation" />
        <div>Genre: @item.Eventgenre</div>
        <div>Acteurs:@foreach(Acteuritem a in item.Eventacteurs) {@a.Acteurnaam @a.ActeurImagepath}</div>
        @Html.DropDownList("Tickets", tickets.Select(ticket => new SelectListItem
        {
            Value = ticket.Value,
            Text = ticket.Text,
            Selected = ViewData["Ticketselect"] == ticket.Value
        }))
        <div>
            Naam: @item.Eventreview
            Onderwerp: @item.Eventreviewonderwerp
            Bericht: @item.Eventreview
        </div>

        // HERE
    }

Right HERE i'd like to have a button that does the following Razor method:

@Winkelwagen.Instance.AddItem(item.EventID, item.Eventtype, ViewBag.Ticketselect, true, 1)

In wich the following method gets the selected value from the item selected in the dropdownlist (wich i put in the ViewBag.Ticketselect). After the item is added in Winkelwagen i'd like to href it to a specific page.

Due to the way other members in my group programmed the controllers i am unable to use HTTPPOST and GET. The controller ActionResult Detail(string type, string eventid) is already launched with an @Html.ActionLink from another page in wich the the string type and eventid are put into the url and read by the controller. Using httppost or httpget would interupt that proces. Please help me out, i've wasted hours trying to solve this.

I am using razor view engine outside of mvc framework. Before you wonder, there are some project specific reasons.

So While adding pages, I add .cshtml layout and content page. The question is without mvc framework(which takes out possibility of viewback,tempdata) , How can I access variable/data on layout page in content cshtml page? For example: If I have in layout

@data=DB.GetData()

Then Can I have @data accessible in content .cshtml page?

I'm starting to learn some AngularJS and am trying to determine its practicality when working along side ASP.NET MVC.

Let's say I have a view which displays beers from a repository in a table. I could output the information in two ways.

1.Using MVC's Razor Engine

Here, the model containing the beers is processed on the server and the html page rendered.

<h3>Rendered using Razor!</h3>
<table class="table table-striped">
    <thead>
        <tr>
            <th>Name</th>
            <th>Colour</th>
            <th>Tasted?</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var beer in Model)
        {
            <tr>
                <td>@beer.Name</td>
                <td>@beer.Colour</td>
                <td>@beer.Tried</td>
            </tr>
        }
    </tbody>
</table>

2.Using Angular repeat

Here, the HTML is returned straight away and angular performs a AJAX call to the controller to retrieve its model. After it has that data it outputs it into the table.

<h3>Rendered using Angular!</h3>
<table class="table table-condensed table-striped">
    <thead>
        <tr>
            <th>Name</th>
            <th>Colour</th>
            <th>Tasted?</th>
        </tr>
    </thead>
    <tbody>

        <tr data-ng-repeat="beer in model">
            <td>{{ beer.Name }}</td>
            <td>{{ beer.Colour }}</td>
            <td>{{ beer.Tried }}</td>
        </tr>

    </tbody>
</table>

Controller

angular.module('BeerController', [])
.controller('BeerCtrl', ['$scope', '$http', function ($scope, $http) {

    $scope.model = {};

    $http.get('/Beer/GetBeers').success(function (data) {

        $scope.model = data;

    });


}]);

My Question

Is there a way to use the Razor engine for the initial load of the data and Angular for everything else (paging calls, searching etc.)? In other words, how do I bind existing html to a controllers model in AngularJS?

<table class="table table-striped">
    <thead>
        <tr>
            <th>Name</th>
            <th>Colour</th>
            <th>Tasted?</th>
        </tr>
    </thead>
    <tbody>
            <tr>
                <td>Fosters</td>
                <td>Gold</td>
                <td>True</td>
            </tr>
            <tr>
                <td>Becks</td>
                <td>Amber</td>
                <td>False</td>
            </tr>
            <tr>
                <td>Cobra</td>
                <td>Gold</td>
                <td>True</td>
            </tr>
    </tbody>
</table>

I've got a small MVC 4 application running (C# / Razor) and have no problem getting a jQuery popup for any rows returned in a dialog, when clicking on the "Details" link. However, when clicking on the "Edit" link, I get a blank dialog. Any ideas?

I've searched and searched, but haven't found anything that works yet. New to MVC also :(

JavaScript code here:

<script type="text/javascript">
        $(function () {
                $('.dialog-details').click(function () {
                    var url = $(this).attr('href');
                    var dialog = $('<div style="display:none"></div>').appendTo('body');
                    dialog.load(url, {},
                        function (responseText, textStatus, XMLHttpRequest) {
                            dialog.dialog({
                                width: 1145,
                                height: 600,
                                modal: true,
                                title: "Reference Details",
                                close: function (event, ui) {
                                    dialog.remove();
                                }
                            });
                        });
                    return false;
                });
            });
    </script>

Razor syntax here: (first link works, second link displays a blank dialog)

@Html.ActionLink("Details", "Details", new { id = item.ReferenceID }, new { @class = "dialog-details" })
@Html.ActionLink("Edit", "Edit", new { id = item.ReferenceID }, new { @class = "dialog-details" })

When the Edit link is used without the jQuery dialog class, it opens the page with all the information for editing - so controller looks fine.

I've got a list of items on a page, capable of being filtered by a textbox (similar to the MVC tutorial). I have a button which I would like to clear the text in the TextBox and call the controller function which will then bring the list of items back to its initial, unifiltered state.

The problem I am having is twofold: my jQuery code which clears the text of the TextBox does not clear the TextBox of the search term, and my jQuery code which explicitly passes in the empty string as a parameter to my controller does not pass in that parameter.

For example:

  1. Page has a list of stuff.
  2. I type "fart" in the filter box, and hit enter.
  3. The page reloads, and the list of stuff is now filtered by "fart".
  4. I press the Clear button.
  5. The page reloads, but the list of stuff is still filtered by "fart", and the TextBox is not cleared.

I suspect this is all due to the TextBox not being cleared, but I honestly have no idea.

Index.cshtml

@{
    ViewBag.Title = "Index";
    var modelitem = new MyThing();
}

@model IEnumerable<MyModel>

<script type="text/javascript">
    function fart() {
        $('#reset').click(function() {
            $('#filterTerm').val('');
            $.get("SelectionSummary/Index", { filterTerm: '' })
        });
    }
</script>

@using (Html.BeginForm())
{
    <div class="input-group center-block">
        <h3 class="text-center">Selections</h3>
        @Html.AntiForgeryToken()
        @Html.TextBox("filterTerm", null, new
                   {
                        @id = "filterTerm",
                        @class = "form-control col-md-offset-2",
                        @placeholder = "Filter"
                   })
        <input id="reset" class="btn btn-info" type="submit" value="reset" onclick="fart"/>
    </div>
}

<br />
@if (Model != null && Model.Any())
{
<div class="panel panel-default col-md-offset-2" style="width:62%">
    <div class="panel-body">
        <br />
        <table class="table table-striped text-center">

            <tr>
                <th>
                    @Html.DisplayFor(m => modelitem.NameLabel)
                </th>
                <th>
                    @Html.DisplayFor(m => modelitem.Thing)
                </th>
            </tr>
            @foreach (var thing in Model.OrderBy(g => g.Name))
            {
                <tr>
                    <th>
                        @Html.ActionLink(thing.Name, "Detail", new { selectionSearchTerm = thing.Name })
                    </th>
                    <th>
                        @Html.DisplayFor(m => thing.Other.Name)
                    </th>
                </tr>
            }
        </table>
    </div>
</div>
}
else
{
    <h4 class="text-center">No results</h4>
}

SelectionSummaryController.cs

 public ActionResult Index(string filterTerm = "")
 {
        var stuff= m_repo.GetAllStuff();
        if (stuff.IsNullOrEmpty()) // extension method
        {
            return View();
        }

        if (filterTerm.HasValue()) // extension method
        {
            stuff= stuff.Where(t => t.Name.Contains(filterTerm));
        }

        return View(stuff.ToList());
 }

I have a dataset and I'm required to display it in a Web Application. Here is what the dataset looks like:

Point_ID    Project No.    Project Manager    Comments
A007        1304           Oscar Duran        Found destroyed
A008        1304           Oscar Duran        Helicopter access
A009        1356           Julio Bravo        Airport parking lot

Here is what I have for my code:

@{
var db = Database.Open("ControlPoints");                                            
var SelectCommand = "SELECT * FROM AllControlMergedWD";                       
var SearchTerm = "";                                                                

if(!Request.QueryString["SearchCP"].IsEmpty() ){                                    
    SelectCommand = "SELECT * FROM AllControlMergedWD WHERE Point_ID = @0";         
    SearchTerm = Request.QueryString["SearchCP"];                                   
}

if(!Request.QueryString["SearchProject"].IsEmpty() ){                               
    SelectCommand = "SELECT * FROM AllControlMergedWD WHERE [Project Used on] LIKE @0";
    SearchTerm = "%" + Request["SearchProject"] + "%";
}

var SelectData = db.Query(SelectCommand, SearchTerm);                               
var grid = new WebGrid(source: SelectData, rowsPerPage: 10);                        
}

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Airborne Imaging Control Points Database</title>

    <style type="text/css"> 
        .grid { margin: 4px; border-collapse: collapse; width: 600px; }
        .grid th, .grid td { border: 1px solid #C0C0C0; padding: 5px; }
        .head { background-color: #E8E8E8; font-weight: bold; color: #FFF; }
        .alt { background-color: #E8E8E8; color: #000; }                                  
    </style>

</head>
<body>
    <h1>Airborne Imaging Control Points Database</h1><br/><br/>                             
    <form method="get">
        <fieldset>                                                                  
            <legend>Search Criteria</legend>                                        
            <div>
                <p><label for="SearchCP">Control Point ID:</label>                   
                <input type="text" name="SearchCP" value="@Request.QueryString["SearchCP"]" placeholder="Leave blank to list all"/> 
                <input type="submit" value="Search"/></p>                               
            </div>
            <div>
                <p><label for="SearchProject">Project:</label>                          
                <input type="text" name="SearchProject" value="@Request.QueryString["SearchProject"]" />
                <input type="Submit" value="Search" /></p>
            </div>
        </fieldset>
    </form>
    <div>
        @grid.GetHtml(                                                          
            tableStyle: "grid",                                                 
            headerStyle: "head",                                                
            alternatingRowStyle: "alt",                                         
            columns: grid.Columns(
                grid.Column("Point_ID"),
                grid.Column("Project No."),
                grid.Column("Project Manager"),
                grid.Column("Comments")
            )
        )
        <br/><br/>
    </div>
</body>
</html>

What I have been trying to do is turning the 'Comments' cells into form elements (text box), so that anybody with access to the Application will be able to add comments, edit or update statuses of the current condition of the points. Could you please help me achieving that?

Thank you beforehand.

public class Notes
{
    public string noteId { get; set; }
    public string noteBody { get; set; }
}

public class Response
{
    public string status { get; set; }
    public string message { get; set; }
    public List<Notes> notes { get; set; }
}

I am able to read data from a JSON stream get the header information (status and message). How do I get data from the list notes into individual variable using foreach loop or another method? Thanks...

I am using razor view engine outside of mvc framework. Before you wonder, there are some project specific reasons.

So While adding pages, I add .cshtml layout and content page. The question is without mvc framework(which takes out possibility of viewback,tempdata) , How can I access variable/data on layout page in content cshtml page? For example: If I have in layout

@data=DB.GetData()

Then Can I have @data accessible in content .cshtml page?

I have a csv file on the server side which is retrieved by the client with a jquery ajax call.

I'd like to hide the text from prying eyes and also ensure the .csv file cannot be viewed or opened using client tools other than my code.

Trying to open in new window with binding url value to hyperlink in my GridView ItemTemplate.

<a href="javascript:openWin('<%# Eval("ReportUrl") %>')"

With localhost everything working good. But when I publishing on Azure Hyperlink Field always empty.

<a href="javascript:openWin('')" style="color: #666666">1189535405</a> //Rendered Row

any idea?

Thanks in advance

I have written a console application to insert a file into a google drive. This is the part of my code that inserts the file.

 private Task<IUploadProgress> UploadFileAsync(DriveService service, string fileName, ParentReference parent)
    {
        var fileInfo = new System.IO.FileInfo(fileName);


        var title = fileName;

        if (title.LastIndexOf('\\') != -1)
        {
            title = title.Substring(title.LastIndexOf('\\') + 1);
        }

        var uploadStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);

        var insert = service.Files.Insert(new File { Title = title, Parents = new List<ParentReference> { parent } }, uploadStream, GetMimeType(fileName));

        insert.ChunkSize = FilesResource.InsertMediaUpload.MinimumChunkSize * 2;
        insert.ProgressChanged += OnInsertProgressChanged;
        insert.ResponseReceived += OnInsertResponseReceived;

        var task = insert.UploadAsync();

        task.ContinueWith(t =>
        {
            Console.WriteLine("Upload Failed. " + t.Exception);
        }, TaskContinuationOptions.NotOnRanToCompletion);

        task.ContinueWith(t =>
        {
            uploadStream.Dispose();
        });

        return task;
    }

This works fine. However what I want to do next is instead of just inserting the file is to check if a file already exists and if so update the file instead of inserting it. I have added the following code to try and find the fileID

private async Task<string> GetFileId(DriveService service, string title, ParentReference parentReference)
    {
        var existingList = service.Children.List(parentReference.Id);

        existingList.Q = String.Format("title = '{0}'", title);

        var list = existingList.Execute();

        if (list.Items.Count > 0)
        {
            return list.Items.FirstOrDefault().Id;
        }

        return null;
    }

I need to use something along the lines of

var update = service.Files.Update(...............)

but not sure what to put in there and how do I check if the file already exists?

Thanks in advance

i am trying to get the value of selected check-box using model but not able to get as i want ;

Below is the table image enter image description here

below is my code for this VIEW

enter image description here

And below is the code for result.I get null value

enter image description here

And below is my model declaration

public class RoleDetail
  {
    [Key]
    public int RoleDetailID { get; set; }

    public bool IsCreate { get; set; }
    public bool IsDelete { get; set; }
    public bool IsView { get; set; }
    public bool IsEdit { get; set; }
    public bool IsDownload { get; set; }
    public string ControllerName { get; set; }
    public System.DateTime CreateDate { get; set; }
    public Int32 UserTypeId { get; set; }
}
public enum ControllerName
{
    Account, Candidate, Career, ChooseUs, ContactUs, DocumentType, Employee, Gallery, GalleryType, GetTouch, Home, JobCategory, Jobs, Portfolio, ResumeUpload, RoleDetail, Services, User, UserRoleType

}

Using ASP.Net Web Forms Application ; How to create crystal report with Entity framework datasource and if not possible what is the best way to use entity framework with crystal report in ASP.Net ?

I'm seeing an issue where my application is throwing an exception reading as follows:

Exception information: Exception type: PlatformNotSupportedException Exception message: This operation requires IIS integrated pipeline mode. at System.Web.HttpRequest.Abort() at System.Web.HttpRequestWrapper.Abort() at System.Web.Http.WebHost.HttpControllerHandler. d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotifica>tion(Task task) at System.Web.Http.WebHost.HttpControllerHandler.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.WebHost.HttpControllerHandler.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) at System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Setting the pipeline to Integrated mode isn't an option because of a large amount of legacy code that depends on Classic mode. Most of the errors I've seen have been related to setting response headers, but I'm not doing that here. The entry in the Event Viewer is showing the request URL, and here's the controller method that is being executed at that path:

[ApiAuthorize]
    [HttpPost, Queryable(AllowedQueryOptions = AllowedQueryOptions.All, PageSize = 25)]
    public IQueryable<usp_Collections_GetCustomersWithActionsForUser_Result> GetCustomersWithActionsDue([FromODataUri] int key)
    {
        //TODO: Add handling to return 404 or other status code if no records are returned
        //      Also add general try catch
        var customersWithActionsDue = ClientData.usp_Collections_GetCustomersWithActionsForUser(key, 1).AsQueryable();

        return customersWithActionsDue;
    }

The application returns a response correctly, formatted as JSON, the exception is only being logged in the event viewer and isn't stopping the request from processing. It's also a little hard to reproduce since I'm unable to do so locally, I suspect it's something in the configuration of the remote web server. Anyone have any ideas what might be causing it? Any help would be greatly appreciated. Thanks!