Hopefully this is a easy question, i tried to do what i cound do on my own. But i can't solve the rest part.

Out for every row, i want to check if the date is heigher or lower equels to the last. But how?

As you can see yon on the image and the sample code.

Click and see the image exsample

And the following code:

@using Scoutpocket.Models.Database;
@model Tuple<List<Properties>, List<SubProperties>, List<Rating>>

<div class="container">

    @foreach (var item in Model.Item1)
    {
        <br />
        <br />
        <b>
            @item.PropertiesName
        </b>

        <br />




        foreach (var item2 in item.SubProperties)
        {
            @item2.SubPropertiesName<br />

            int count = 2;
            int getLast = 1;


            foreach (var item3 in item2.rating.Where(x => x.PlayerID == 1).Take(count).OrderByDescending(x => x.Date))
            {

                for (int i = 0; i < getLast; i++)
                {
                    // Check the index of the last row, and check if the current date is lower or heighter.


                    <b>Compare date on last and newst</b>
                }

                <span>Rating ID: @item3.RatingID</span>
                <span> | </span>
                <span>Value: @item3.Value</span>
                <span> | </span>
                <span>ScoutID: @item3.ScoutID</span>

                <span> | </span>
                <span>PlayerID: @item3.PlayerID</span>

                <span> | </span>
                <span>Date: @item3.Date</span>
                <br/>
            }

        }
    }

</div>

I have a simple ASP application page added in a SharePoint project just for presentation purposes, so it's ASP web forms page is hosted in SharePoint.

HTML:

</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <asp:Label runat="server">Number 1:</asp:Label>
    <asp:TextBox ID="num1" runat="server"></asp:TextBox>
    <asp:Label runat="server">Number 2:</asp:Label>
    <asp:TextBox ID="num2" runat="server"></asp:TextBox>
    <asp:Label runat="server">Result:</asp:Label>
    <asp:TextBox ID="res" runat="server"></asp:TextBox>
    <asp:Button Text="ADD Numbers" runat="server" OnClick="Unnamed_Click" />
    <asp:ListBox runat="server" ID="list" />
    <asp:Label runat="server" ID="previousListValue"></asp:Label>
    <asp:Label runat="server">Exception:</asp:Label>
    <asp:TextBox ID="exception" runat="server"></asp:TextBox>
</asp:Content>

Here is code behind:

public partial class Default : LayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            list.DataSource = new List<ListItem>() { 
                new ListItem("value1", "1"),
                new ListItem("value2", "2"),
                new ListItem("value3", "3"),
            };
            list.DataBind();
        }
    }

    protected void Unnamed_Click(object sender, EventArgs e)
    {
        try
        {
            res.Text = Convert.ToString(int.Parse(num1.Text) + int.Parse(num2.Text));
            previousListValue.Text = "Previous list selected value is: " + list.SelectedItem.Value;
            exception.Text = string.Empty;
        }
        catch (Exception ex)
        {

            exception.Text = ex.GetType().ToString() + "\t" + ex.Message;
        }
    }
}

When you click "ADD Numbers" button and addition of num1 and num2 textboxes is appended to the res textbox and selected value of ListBox is shown in label next to it. This works flawlessly if correct values are entered for a number and an item is selected in ListBox.

If the page is left (not interacted with) for about 10-15 minutes and "ADD Numbers" button is clicked, NullReferenceException will be thrown for list.SelectedItem.Value and also textBoxes will be empty. What happened is that the application is in postBack state(Page.IsPostBack is true) but viewstate is not restored.

I guess this has something to do with ViewState being moved to distributed cache as of version 2013 but can someone clarify this for me, and suggest me the most effective way to go about this, without changing AppFabric configuration, because 10-15 minutes of ViewState perversion is not acceptable.

I'm working on a project with Asp.Net MVC 5 and Asp.Net Identity and I'm using two factor authentication. For the login I use:

var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser);

which is the default code that came with the new project. However, I also need the ability for a user to "trust" or "remember" a browser, similar to how banks can indicate if this was the first time you have signed in from a particular browser/pc.

My question is around the RememberBrowser property on the sign in method and what .NET Identity does with this data. I want the list of saved browsers and the ability to revoke access to one/and-or all of them. Is that possible within the Identity framework? Also, can I tell if a browser has been "trusted" before by some type of lookup?

Hi everyone, I'm going to start with a new experience with dotnet core using the MVC pattern.

Which are the new helpers for checkbox, textarea and other?

In this moment the relative page is empty : https://docs.microsoft.com/en-us/aspnet/core/mvc/views/html-helpers

I've tried this :

<input asp-for="myField" class="form-control" type="checkbox" value="False"/> but doesn't work!

Thanks in advance.

USED :

For choosing a directory(folder) in html got webkitdirectory directory but it is not working in IE.

How to copy files with size of 1 TB between two different geo located servers.

For my ASP.Net MVC Webapplication, I have some objects of classA which need to be referenced to every object of classA, including itself, and each connection needs another object of classB. I've stored all these objects in other objects from classC. All this data is stored in a database.
This gives me a huge list, larger the more objects from classA there are, because when I add a new object of classA, this table needs to be updated, though this is not part of the question.

Now I want to display this table but as a matrix.

I have:

    <table border="1">
      <tr>
        <th>Object 1 (classA)</th>
        <th>Object 2 (classA)</th>
        <th>Value (classB)</th>
        </tr>
      <tr>
        <td>ASDF</td>
        <td>ASDF</td>
        <td>value1</td>
        </tr>
      <tr>
          <td>ASDF</td>
        <td>QWER</td>
        <td>value2</td>
        </tr>
      </table>

I want:

    <table border="1">
          <tr>
            <td/>
            <th>Object 1 (classA)</th>
            <th>Object 2 (classA)</th>
            </tr>
          <tr>
            <th>Object 1 (classA)</th>
            <td>value1</td>
            <td>value2</td>
            </tr>
          <tr>
              <th>Object 2 (classA)</th>
            <td>value2</td>
            <td>value1</td>
            </tr>
          </table>

My problem is, that I can't just iterate over all entries in my current table and display it on my HTML page, since it would be redundant (and therefor huge) as hell.

My question now is, how can I display my data as I want?
I've looked for similar questions but none of what I found were using the same class twice.

I am in situation where i need to enable admin user to update view layout and display content for a specific group of user . I have no idea how can i enable admin user to change layout reference to the new page when other next time user access that page.I want something like wordpress page that admin can customize from GUI.

Anyone can have suggestions .how can i do this?

Thanks

I'm trying to publish my first ASP.Net website, but I'm getting this error when I try to visit the homepage.

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Here's the section of the web.config file it is referencing:

  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>

And here's the website itself if you want to see the full error page:

http://connellchamberofcommerce.com/

Is the ASP.Net version (4.5.2) supposed to match the .Net version my host uses or something? As I said, this is my first ASP.Net website and I'm pretty confused by this error.

This question already has an answer here:

I am using MVC5 and Razor for my website.

My site should have function to upload an file (it would be text file like .txt or .doc , .docx etc.).

I've managed to save file to my database but have no idea how to read it nor how to display content of file (text).

My Applicant model:

public class Applicant
{
    // Some irrelevant properties of applicant like name, gender etc.

    [Display(Name = "CV: ")]
    public virtual ICollection<File> uploadedFiles { get; set; }
}

My File model:

public class File
{
    [Key]
    public int fileID { get; set; }

    public string fileName { get; set; }
    public int applicantID { get; set; }
    public byte[] Content { get; set; }
    public string ContentType { get; set; }
    public virtual Applicant Applicant { get; set; }
}

My controller POST method:

        // POST: Prijava/Create
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create([Bind(Include = "irrelevant properties,uploadedFiles")] Applicant prijava, HttpPostedFileBase upload)
    {
        if (ModelState.IsValid)
        {
            if (upload != null && upload.ContentLength > 0)
            {
                var cv = new Models.File
                {
                    fileName = Path.GetFileName(upload.FileName),
                    ContentType = upload.ContentType
                };

                using (var reader = new BinaryReader(upload.InputStream))
                {
                    cv.Content = reader.ReadBytes(upload.ContentLength);
                }

                prijava.uploadedFiles = new List<Models.File> { cv };                   

                ViewBag.Message = "File uploaded successfully";
                }

            else
            {
                ViewBag.Message = "File upload failed.";
            }
        }
    }

For testing purpose uploaded .txt file contains text: "THIS IS TEST FILE !!!", in database file is stored like: "0x5448495320495320544553542046494C4520212121"

So I have my file written in binary to my database but have no clue how to display content in view and as an download.

I am working with Visual Studio(VS) and am trying to deploy a website to IIS 7. When I deploy the website, it does not display the same as it does in VS. The pages overflow the areas that they should and create a scroll bar when they should fit within the bounds given using the row col format of bootstrap.

There are no 404 errors for the Bootstrap scripts on the page.

Here's what the Website looks like for the first section:

enter image description here

As you can see the Create Test tab is overflowing the section it should fit in using the bootstrap col classes.

Here is the code for the section:

enter image description here

and this is the code for Create Test:

@{
ViewBag.Title = "CreateTest";
}
<script language="JavaScript">

 function WORK(){
    var choice = document.getElementById("selector").value
    if (choice == 1) {
        document.getElementById("WhiteCal").style.display = "block"
        document.getElementById("Conf").style.display = "none"
        document.getElementById("Calib").style.display = "none"
        document.getElementById("SMP").style.display = "none"
        document.getElementById("MinM").style.display = "none"

    } else if (choice == 2) {
        document.getElementById("WhiteCal").style.display = "none"
        document.getElementById("Conf").style.display = "block"
        document.getElementById("Calib").style.display = "none"
        document.getElementById("SMP").style.display = "none"
        document.getElementById("MinM").style.display = "none"

    } else if (choice == 3) {
        document.getElementById("WhiteCal").style.display = "none"
        document.getElementById("Conf").style.display = "none"
        document.getElementById("Calib").style.display = "block"
        document.getElementById("SMP").style.display = "none"
        document.getElementById("MinM").style.display = "none"

    } else if(choice == 4){
        document.getElementById("WhiteCal").style.display = "none"
        document.getElementById("Conf").style.display = "none"
        document.getElementById("Calib").style.display = "none"
        document.getElementById("MinM").style.display = "none"
        document.getElementById("SMP").style.display = "block"
    } else {
        document.getElementById("WhiteCal").style.display = "none"
        document.getElementById("Conf").style.display = "none"
        document.getElementById("Calib").style.display = "none"
        document.getElementById("SMP").style.display = "none"
        document.getElementById("MinM").style.display = "block"
    }
}
</script>

<br />
<div class="row" style="overflow-y:auto;">
<div class=" container col-lg-12">
    <h3 style="text-align:center;">Create Test</h3>
    <div class="container" style="height:60%; overflow-y:auto">

        <div class="row">

            <label>Select Test Type:</label>

            <select id="selector" onchange="WORK(this)" class="div-toggle">
                <option selected disabled>Choose here</option>
                <option value="1">White Calibration</option>
                <option value="2">Conformance</option>
                <option value="3">Calibration</option>
                <option value="4">SMPTE</option>
                <option value="5">Min/Max</option>
            </select>



        </div>


        <br />

        <div class="row"><br /></div>


    </div>

    <div class="container" style="height:40%;">

        <div class="Testy">
            <div id="WhiteCal" style="display:none">
                @Html.Action("WhiteCal", "Home");
            </div>
            <div id="Conf" style="display:none">
                @Html.Action("Conformance", "Home");
            </div>
            <div id="Calib" style="display:none">
                @Html.Action("Calibration", "Home");
            </div>
            <div id="SMP" style="display:none">
                @Html.Action("SMPTE", "Home");
            </div>
            <div id="MinM" style="display:none">
                @Html.Action("MinMax", "Home");
            </div><br/>
            <div class="row">
                <p id="suce" style="color:red;"></p>
            </div>
        </div>

    </div>
</div>
</div>

Any ideas for solutions would be appreciated. Thanks

how do i convert this to cshtml with razor tags...........................................................................................................................................................

    <!-- Basic -->
    <meta charset="UTF-8">

    <title>Modals | SHARED ON THEMELOCK.COM</title>
    <meta name="keywords" content="HTML5 Admin Template" />
    <meta name="description" content="Porto Admin - Responsive HTML5 Template">
    <meta name="author" content="okler.net">

    <!-- Mobile Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <!-- Web Fonts  -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">

    <!-- Vendor CSS -->
    <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
    <link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
    <link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />

    <!-- Specific Page Vendor CSS -->
    <link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />

    <!-- Theme CSS -->
    <link rel="stylesheet" href="assets/stylesheets/theme.css" />

    <!-- Skin CSS -->
    <link rel="stylesheet" href="assets/stylesheets/skins/default.css" />

    <!-- Theme Custom CSS -->
    <link rel="stylesheet" href="assets/stylesheets/theme-custom.css">

    <!-- Head Libs -->
    <script src="assets/vendor/modernizr/modernizr.js"></script>

</head>

I am trying to add a glyphicon for each button the same way as how google maps has it for selecting a travel mode i tried the way as shown below for the first button but nothing shows up i got the glyphicon from http://glyphicons.com/

    <div class="btn-group" role="group" >
        <asp:LinkButton runat="server" class="btn btn-default"><span aria-hidden="true" class="glyphicons glyphicons-car"></span></asp:LinkButton>
        <asp:LinkButton runat="server" class="btn btn-default" />
        <asp:LinkButton runat="server" class="btn btn-default" />
        <asp:LinkButton runat="server" class="btn btn-default" />
    </div>

I noticed that, in some rare occasion, the cached info for either the css, js or any other scripted file might be outdated and I wanted to avoid having to disable caching for every browser so I started learning about the pros and cons about cache headers. But, it's all very confusing and overwhelming specially when it comes to implementation.

If I could get a link or if somebody would point me in the right direction in terms of the "what, where and when", I would gladly appreciate it.

I apologize if my question isn't clear. English isn't my main language.

I have a fieldset in my HTML which basically represents 5 star rating system like following:

<fieldset class="rating" id="ratingSystem">
    <input type="radio" id="star5" name="rating" value="5" /><label class="full" for="star5" title="Awesome - 5 stars"></label>
    <input type="radio" id="star4" name="rating" value="4" /><label class="full" for="star4" title="Pretty good - 4 stars"></label>
    <input type="radio" id="star3" name="rating" value="3" /><label class="full" for="star3" title="Meh - 3 stars"></label>
    <input type="radio" id="star2" name="rating" value="2" /><label class="full" for="star2" title="Kinda bad - 2 stars"></label>
    <input type="radio" id="star1" name="rating" value="1" /><label class="full" for="star1" title="Sucks big time - 1 star"></label>
</fieldset>

And I've defined an onclick event which defines when user clicks on some of the star ratings (radio buttons) then I'd simply for testing purposes display the clicked value, but I always get double values displayed instead of the displayed one...

For instance if I clicked on 5 I get displayed in console:

undefined  
5

Second time I click on 4 I get values:

5
4

The code I use for it is:

$('#ratingSystem').click(function () {
        console.log($('input[name=rating]:checked').val());
    });

What am I doing wrong here?

Edit, these are the CSS classes that I use to turn the radio buttons into stars so that it looks like star rating system:

fieldset, label { margin: 0; padding: 0; }
body{ margin: 20px; }
h1 { font-size: 1.5em; margin: 10px; }

/****** Style Star Rating Widget *****/

.rating { 
  border: none;
  float: left;
}

.rating > input { display: none; } 
.rating > label:before { 
  margin: 5px;
  font-size: 1.25em;
  font-family: FontAwesome;
  display: inline-block;
  content: "\f005";
}

.rating > .half:before { 
  content: "\f089";
  position: absolute;
}

.rating > label { 
  color: #ddd; 
 float: right; 
}

/***** CSS Magic to Highlight Stars on Hover *****/

.rating > input:checked ~ label, /* show gold star when clicked */
.rating:not(:checked) > label:hover, /* hover current star */
.rating:not(:checked) > label:hover ~ label { color: #FFD700;  } /* hover previous stars in list */

.rating > input:checked + label:hover, /* hover current star when changing rating */
.rating > input:checked ~ label:hover,
.rating > label:hover ~ input:checked ~ label, /* lighten current selection */
.rating > input:checked ~ label:hover ~ label { color: #FFED85;  } 

Could any of these classes be the source of the issue?

I'm trying to develop a simple BOM (Bill of Materials) manager, which should manage thousands of components at varius levels of relationship (Parent child records).

I would like to know what would be the best solution for registering all components (Grandfathers, parents and childs) in a single table and then, query the data using some kind of SQL query (eg CTE's). In my table, I need to resolve another question: In several cases, a child is used in several parents, but the quantity of childs for a particular parent changes. For example: I have a child called Bolt. For a specific parent, I use 10 (ten) bolts. For another parent, I use 20 (twenty) bolts (The same Bolt with the same Part Number). In parallel, the same parent can be used by several grandfathers, and so on.

For this solution, I'm creating a Web Form in ASP.NET (Using VB.NET) and I'm using a simple database in MS ACCESS. In my program, I'm using the OLEDB provider.

Please, see below an example of my Table, called 'Components':

Example for Table 'Components'

Thank you very much!

new to MVC so here is my question.

I am wanting to load another view if the user falls into a category. As an example:

if (presenter == "NEW")
{
   return RedirectToAction("AddPresenter", "AddPresenter", null);
} else {
   return View();
}

I'm calling this code inside the public class SwitchboardController : Controller.

Though doing the above does not seem to load the AddPresenter view and still loads the current View (which is called Switchboard). And of course it gets errors when loading the Switchboard view since I have some RAZOR code on the Index.cshtml page that it doesn't have any data for.

I've tried both:

return RedirectToAction("AddPresenter", "AddPresenter", null);

and

return View("~/Views/AddPresenter/Index.cshtml");

And neither seem to work. They both just load up the Switchboard Index.cshtml page instead of the needed AddPresenter Index.cshtml page.

What kinds of things can I do in order to correct this the way I need to load the views?

I am trying to create an ASP.NET webforms application that will have both Individual User Accounts authentication, but additionally authentication for users within the company domain (active directory). The company also has Office365 if this would help.

Is it possible to do this?

I am using Entity Framework and I have a class called HomesClass and I this line in my edit method:

HomesClass homesClass = db.Data.Find(id);

so I tried to do another line like this

HomesClass homesClass = db.Data.SqlQuery("SELECT ....");

But then I get this error:

Cannot implicitly convert type 'System.Data.Entity.Infrastructure.DbSqlQuery<Project.Models.HomesClass>' to ‘Project.Models.HomesClass'

My question is how to do I convert this properly?

I got a web service from third party(http://.....?wsdl). I can only access to wsdl and xsd from browser. I work on Visual Studio C# and I can't add it by AddWebReference to my proyect because it needs authentication(username and password).

So, I create an archive( service.wsdl ) and by wsdl.exe in my command prompt I generate a service.cs archive

I added service.cs in my .NET project

That's fine so far. The thing is everytime I invoke a method, it says that I need a username and password in the header HTTP.

Any suggestions to add/modify a HEADER with username and password everytime a call a method?

In soapUI you can add header in every call manually and works. In .NET someting is missing from my code.

Regards

I have a .NET MVC project and I'm trying to download a file from temporary folder. Here is my view code:

window.open('@Url.Action("DownloadDocument", "Controller")?fileName=' + fileName, '_blank');

And here is my controller code:

    public FileResult DownloadDocument(string fileName)
    {
        string path = Web.Common.Properties.Settings.Default.TempDocPath + "OpenTable\\";
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        return File(fileName, "application/xml", fileName + ".xml");
    }

This code works on IIS and file is being downloaded. But I'm getting 500 error when trying to download it from remote server.

This site can’t be reached The webpage at <...> might be temporarily down or it may have moved permanently to a new web address. ERR_INVALID_RESPONSE

And the worst part is that there are some almost exact code snippets in the system which are working in both IIS and remote server.

Any suggestions what could be done?