[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

.NET MVC

223

Solutions

233

Contributors

Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Share tech news, updates, or what's on your mind.

Sign up to Post

There is a requirement that there will be the grid of employee having name,id,gender etc..And there will be the dropdownlist of employee names outside of grid. the requirement is that the values in the grid of employee name need to be populated at the top of dropdownlist. where we can do this whether in client side or server side. if cilent side means how we can achieve that scenario
0
Determine the Perfect Price for Your IT Services
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

i have mvc / c# /razor app that have been using for many years.
Now I want to have a page that can keep scroll position. e,g, i have razor webpage and inside have 5 to 8 buttons, and each each usually do some post back with jquery call.

I just want something super simple so I can implement the feature. Thanks

See below has some sample but I do not know how to implement them.

https://stackoverflow.com/questions/11653152/mvc-razor-outputting-text-in-position-to-the-screen/11653295
0
I'm trying to load html data into a modal window

I've got it working, however I now need to pass in a ID to this to return the correct record

I currently have this code which is working
$.ajax({
    type: "POST",
    async: false,
      url: "@Url.Action("CameraImage", "Home")",
    data: "{'myId': '" + this.specialId + "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",

    success: function (data) {
        $("#modal-body").html(data);
        $("#myModal").modal("show");
    },
    error: function () {
        alert('error!');
    }
})

Open in new window


and then in the homecontroller
 [HttpPost]
        public PartialViewResult CameraImage(int myId)
        {
            //var requestedImageData = processData.LoadGraphImageData(myId);
                
            return PartialView("~/Views/Home/CameraImage.cshtml");
        }

Open in new window


This is working fine and returns the data into the popup modal window

Its the next bit i'm stuck on
I need to pass in the ID and pull out the data relevant to that ID and display in the popup modal

I've already got the ID passed to the home controller, but i'm unsure how to display the html

in the home controller, this line gets a datetime, image location and some other strings of data
var requestedImageData = processData.LoadGraphImageData(myId);

Open in new window


I would this like to return some formatted html i.e.
<div id="image">image pic goes here</div>
<div id="imageDate">12th jan 2016</div>
<div id="otherString">otherString goes here</div>

Open in new window


currently my cshtml for the partialview just has this text:
This is partial view

I'm unsure how to link the partialview html with the data from the object (imageLocation, imageDate etc)

Can someone help me solve that please
0
Hello,
Any suggestions on Project example for Asp.net MVC .

Cheers
0
Hello,
I am trying to build an app in ASP.NET MVC amd get this error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /Views/Random.cshtml

Open in new window


Any suggestions?

Thanks
0
we are looking for 800 phone no with api. meaning when someone call 800 phone no. we want api to be called immedately to www.myweb.com/phone no
then redirect to 310.222.2222

do you know which provider can. do it? just like something out of the box without too much coding involved
0
Hi All,
Advance thanks!
Have jqgrid and need hyper link on one of the column. Click the link , show new popup window. Closing the window , refresh the parent screen.

Kind regards,
Pooja
0
I am using MVC 5 with entity framework version 6 and a SQL server database. I used the database first model to generate the model, controllers, and views.

I have a database with existing data. It has a list of customers and related meetings. One table contains the customers and the other table contains the meetings. One customer can have multiple meetings but a meeting is only associated with a single customer.

I want a link on the Customer details page to create a new meeting based on the ID of the customer in the details view.
 

Here is the code for the customer details view.
@model CRM.Models.Customer

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<div id="CustomerDetails">
    <h4>Customer</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.SystemOfRecordId)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.SystemOfRecordId)
        </dd>
        <br />
        @*<dt>
                @Html.DisplayNameFor(model => model.Relationship)
            </dt>

            <dd>
                @Html.DisplayFor(model => model.Relationship)
            </dd>*@

        <dt>
            @Html.DisplayNameFor(model => model.Tin)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Tin)
        </dd>
        <br />
        <dt>
            @Html.DisplayNameFor(model => model.Name)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Name)
        

Open in new window

0
Hi Team,

website no longer compatible with IE 11, when we enabled compatible mode in IE11 and opens the website one message triggers stating that it is no longer supported with link "https://whatbrowser.org/"when user clicks on it it  says that "website will be unavailiable after 30 Nov 2018"

what is  the best way to handle this scenario, i was advised to addsome custom text something like" turn-off compatiblility mode" ,

Please suggest. Also is there any international site wish support the content in different languages French\German\English\Spanish  etc.

Looking forward to hearing from you.
0
Hi Experts,
I have a text box with ID CustomerEmailAddress and on blur it validates the email and display a warning message at the top. If there is a warning message I want to change the corder color of the text box to red. I added some code(In bold). But still it is not working.  Any suggestions?
 jQuery(document).ready(function () {
        jQuery("#CustomerEmailAddress").blur(function () {
            jQuery.ajax({
                type: "POST",
                url: '@Url.Action("BusinessDomain", "Marketing")',
                data: '{email: "' + jQuery("#CustomerEmailAddress").val() + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    if (response == true) {
                        var CustomerEmailAddress = jQuery("#CustomerEmailAddress").val();
                        CustomerEmailAddress = jQuery.trim(CustomerEmailAddress);
                        var DomainName = CustomerEmailAddress.split("@@")[1];
                        var msg1= "Please provide an email address that has a business domain. Email domains at ";
                        var msg2 = " require further review by the program and will cause a delay in your application being approved.";
                        var msg = msg1 + DomainName + msg2;
                        jQuery("div.validation-summary-warning", "#frmSubmitCustomerInformation").text(msg).show();
                       

Open in new window

0
CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Hi Experts,
I have this to display a message dynamically onblur event of a textbox.
jQuery("#formEnroll").prepend("<div class='validation-summary-warning'>" + msg + "</div>") 

Open in new window


But it keeps adding the div every time when the focus is lost. So how can I check and display  the div only once. only if the div is not exists. It is really urgent!

Thanks in advance.
0
I have this code which calls a controller method from a hompeage.aspx

<a href="Home/Get"><input type="button" value="Click Me" /></a>

Open in new window


How do I pass a parameter to the controller method?
0
Within the actionresult below, i want to redirect to www.google.com.
I tried a few options but still not working...can you help?

 public ActionResult Upload()
        {
             bool isSavedSuccessfully = true;
            string fName = "";
            string fleetID = Request.Url.Segments.Last();
            string returnFleetID = string.Empty;             
            try
            {
                foreach (string fileName in Request.Files)
                {
                    HttpPostedFileBase file = Request.Files[fileName];
                    //Save file content goes here
                    fName = file.FileName;
                    if (file != null && file.ContentLength > 0)
                    {
                        var originalDirectory = new DirectoryInfo(string.Format("{0}Images\\Fleet", Server.MapPath(@"\")));
                        string pathString = System.IO.Path.Combine(originalDirectory.ToString(), "imagepath");//fleetID
                        var fileName1 = Path.GetFileName(file.FileName);
                        bool isExists = System.IO.Directory.Exists(pathString);
                        if (!isExists)                             
                            System.IO.Directory.CreateDirectory(pathString);
                            var path = string.Format("{0}\\{1}", pathString, file.FileName);
                            file.SaveAs(path);
                            returnFleetID = UpdateFleetImage(fleetID,fileName1);
    

Open in new window

0
Hi all

I would like to remotely connect to ms-sql database through port 1433 connection. which service provider/hosting service provider for ASP.NET that can help me get this.

I am having a desktop application. I would want this application to remotely write data to a website database.  

Regards

Anthony
0
MVC applications have a rather unintuitive way to handle date and times within the default scaffolding views of MVC. This article shows the process of changing these to proper date and time pickers using Editor Templates and a rather nice extension library of JQuery UI written by Trent Richardson.
1
I am using MVC 5 with entity framework verison 6 using a SQL database. The ID field is the primary key in the PL_System table and the foreign key in other tables. My problem is with the Create view of PL_System. Since ID is the primary key and is required, it has to have a value. It is set as an int.

The ID field in the create view is a dropdown. How do I get this to be an auto-generated field rather than a selectable list? I want this to be a new system which will take the ID that is next in the sequence of numbers. In this case, the last ID in the table is 55. I want the next system to have the ID 56 and so on...

[Disclaimer: This was an Access database imported into SQL]

PL_System Controller > Create
// GET: PL_System/Create
        public ActionResult Create()
        {
            ViewBag.Availability = new SelectList(db.PL_Availability, "ID", "Score");
            ViewBag.Confidentiality = new SelectList(db.PL_Confidentiality, "ID", "Score");
            ViewBag.Integrity = new SelectList(db.PL_Integrity, "ID", "Score");
            ViewBag.Information_System_Owner = new SelectList(db.PL_SystemOwner, "ID", "Full_Name");
            ViewBag.Status = new SelectList(db.SSP_SystemStatus, "ID", "Title");
            return View();
        }

        // POST: PL_System/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see 

Open in new window

0
I have developed a website (https://inbranchcardprinting.azurewebsites.net) that my credit union will be using to upload a picture from a members phone to our Azure storage blob that will be printed onto their custom debit card. The main issue is right after the upload page (and before the thank you page just fine while exiting that action fine) Safari will display one of two error messages.
The first and most common one is "This web page has been reloaded because a problem has occurred." Sometimes this is accompanied by a dialog box asking to resubmit the form.
However, everything on the back end worked fine. No server side errors were thrown and the image is successfully uploaded to our azure storage. I step through the controller and everything works fine and exits the action with no issue. This problem does not occur on desktop or Android devices.

Now I know that I can reproduce the bug so I look into how to diagnose iOS safari pages and tried to use their Web Inspector tool. I get it loaded up on my Mac just fine and tethered my iPhone to the Safari session. I go to the page and not only does it error on my iOS device it crashes my Mac's Safari window of debugging. So next I try to use Xcode's Simulator and system logging to capture the issue, and nearly the same thing happens only I get an on screen(simulator) error of "This page can not be loaded because the web page stopped responding." This doesn't crash the Simulator, but the logger window did not record …
0
My MVC app works great locally, but when i publish into a virtual directory it calls the wrong path
I.e.  instead of  
Localhost/virtual/Home/PlotProbeData
it calls
Localhost/Home/PlotProbeData

Here is the piece of code in question

 
$.getJSON("/../Home/PlotProbeData", { probe: probeData }, function (data) {

Open in new window


i've looked online and it suggests using url.content or url.action, but what I tried doesn't seem to work

the above code exists inside the cshtml file.
0
https://open.esignforms.com

one of my developers suggest to use this esign api for our company we are heatlh insurance broker in FL.

we all know docsign and they are just so expensive to us
and we don't compare this esign form with docsign.

just want to hear all experts what you think about this product from security, performance, and development sides
0
IT Pros Agree: AI and Machine Learning Key
LVL 1
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

In web forms, I know how to create master page.  Is it possible to create a master page in ASP. Net core MVC? Please show an example and link.
0
I am using ASP.NET MVC 5 with entity framework version 6. I have the PagedList.MVC nuget package installed. I get the error listed below when attempting to sort in my Index view. I'm sure it is something really simple that I am overlooking.

The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.'

Controller Code listed below:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using ITRA.Models;
using PagedList;
using PagedList.Mvc;

namespace ITRA.Controllers
{
    public class SSP_ControlController : Controller
    {
        private RiskAssessmentEntities2 db = new RiskAssessmentEntities2();

        // GET: SSP_Control
        public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page)
        {
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NISTIDSortParm = String.IsNullOrEmpty(sortOrder) ? "NISTID_asc" : "";
            ViewBag.TitleSortParm = String.IsNullOrEmpty(sortOrder) ? "Title_asc" : "";
            ViewBag.WorksheetStatementSortParm = String.IsNullOrEmpty(sortOrder) ? "WorksheetStatement_asc" : "";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            

Open in new window

0
I have very rare website that allow owner and renter to get motorhome similar to turo but now I am looking for insurance companies that partner with us so we can get insurance for each rental

I hope to know what I can do to get start it.
0
I'm new to MVC, so struggling to understand if this is possible

I have a bit of code which I call in the homeController.cs
public ActionResult PlotGraph()

Open in new window


I would like to be able to call this on click of a UI item and pass in a different groupId.....i.e.
public ActionResult PlotGraph(string GroupId)

Open in new window


Then on first load of the page it would need to just load the default group, so i was trying to call it using this from cshtml page:
 
@Html.Action("PlotGraph","0")

Open in new window


I've added the comma and zero, however it fails when it hits this line
Am i doing this totally wrong, or should this be possible, if so how do i make it work?
0
hi;

I want to search in four other dropdown lists and list it in another place. Mvc.Net
0
I wrote this code using ASP.NET webforms and would like to move it to an MVC solution.  What should go in the controller and what should go in the model.  How do I pass information from one to the other?

            string ErrorMessage="";

            //check name lengths are OK.
            if (txtBorrowerFullName.Text.Length == 0)
            {
                ErrorMessage = "Borrower fullname empty. ";
            }
            if (txtBorrowerFullName.Text.Length > 54)
            {
                ErrorMessage = ErrorMessage + "Borrower fullname exceeds 90 characters. ";
            }

            if (txtBorrowerName2.Text.Length == 0)
            {
                ErrorMessage = "Borrower name empty. ";
            }
            if (txtBorrowerName2.Text.Length >19)
            {
                ErrorMessage = ErrorMessage + "Borrower name exceeds 19 characters. ";
            }
            if (txtBorrowerShortName.Text.Length == 0)
            {
                ErrorMessage = "Borrower shortname empty. ";
            }
            if (ErrorMessage == string.Empty)
            {
using (SqlConnection sqlCon = new SqlConnection())
                {
                    using (SqlCommand sqlcmd = new SqlCommand())
                    {
                       ConnectionString = ConfigurationManager.ConnectionStrings["UK1SDI2DSConnectionString"].ConnectionString;
                        sqlcmd.Connection = sqlCon;
                        sqlCon.ConnectionString = 

Open in new window

0

.NET MVC

223

Solutions

233

Contributors

Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Top Experts In
.NET MVC
<
Monthly
>