[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

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
Simplify Active Directory Administration
LVL 8
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

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
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
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
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
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.

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
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 am very new on using json and I want to have very simple code in c# to request docsign signature with json format.

can you show me ? thanks

I have most of the set up like api key and etc already

thanks
0
it works if I use four models but it doesn't work if I use 5 or more

For example;

Ads-z.jpg
0
Hi;
My Problem İs mvc asp.net viewbag.title erorr




please help me
0
SD-WAN: Making It Work for You
SD-WAN: Making It Work for You

As bandwidth requirements and Internet costs grow, businesses naturally want to manage budgets by reducing reliance on their most expensive connection types. Learn more about how to make SD-WAN work for your business in our on-demand webinar!

Is there a way in ASP.NET MVC (c#) to create html markup and save to database and then of course to be able to edit it in a html editor in a view.

Here is the issue.

This control below will only take in text at the moment but i need to add in formatted text. Do i need to add in an editor or is there anything within visual studio/c# mvc that will enable me to add formatted text. If not, please recommend the best html editor for this purpose. Thanks in advance.

    <div class="form-group">
                @Html.LabelFor(model => model.FullDescription, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @*@Html.TextAreaFor(model => model.FullDescription, new { htmlAttributes = new { @class = "form-control" } })*@
                    @Html.TextAreaFor(model => model.FullDescription, 10,40, htmlAttributes: new {style="width: 100%; max-width: 100%;" })
                    @Html.ValidationMessageFor(model => model.FullDescription, "", new { @class = "text-danger" })
                </div>
            </div>
0
I need a help sample code to connect to ZenDesk API using basic authentication, User Email and Token written in C#. Please advise.
0
I have a ASP.Net MVC 5 C# application that uses JWT tokens to GET (request) a token to get access to the database. The issues that I am running into are the c# code for on the IdentityConfig.cs ApplicationUserManger I set the login lockout defaults. Those defaults do not work. I have a MaxFailedAccessAttempts set to 3 when I login with the incorrect password more than 3 times the account does not lockout the user. The user should be locked for 5 minuets (which I don't know if that works because the lockout code is not working). To generate an email which the users gets in their email inbox than click on a link on the email and then takes the user to the password reset page where the password is suppose to be reset by getting a JWT token to GET then PUT the change to update the database table with the new password.
0
Currently I have built an application (using Visual Studio .Net MVC Web Application in C#) which opens up specific views in Sage 300, which I then use to pull specific table information. I am currently trying to get Quantity on Hand data (the number) from Sage 300's IC0290 ROTO ID View. The code I have will only bring back "0". It does bring back other information from the same table as long as the values for that information are strings. The value type for QTYONHAND is BCD*10.4 . I am trying to use Decimal in C# but it brings back a 0. I have the code listed below. If anyone has any ideas on how I can get the actual data to come through, I would greatly appreciate it.

private void OpenSessionDBandView()
    {
        // Create, initialize and open a session.
        session = new Session();
        session.Init("", "XY", "XY1000", "62A");
        session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);

        // Open a database link.
        mDBLinkOpen = session.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite);

        // Open the I/C Items View - "IC0310"
        icItemView = mDBLinkOpen.OpenView("IC0310");

        // Open the I/C Items View (Quantities on Hand) - "IC0290"
        icLocationDetailsView = mDBLinkOpen.OpenView("IC0290");
    }
    public string DoIt()
    {
        string returnHTML;

        OpenSessionDBandView();

        decimal itemQoH;
        // "itemNumber" is a value derived from a form created. User submits …
0
For any new Product development which technology is best - Angular / MVC Core / React ?
0
i just take over a mvc with entity framework project and the developer is gone.
Now I added a column in the database table, and how can i refresh the entity framework so I can continue to code with linq...?

I am not expert with any projects that using entity framework. hope you can help out.

Thanks
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
>