.NET MVC

401

Solutions

299

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 use mailchimp to send email. usually just upload the csv list to mailchimp. nowday, my website is growing and some user changes email address. but i do not know how to keep track. so sometime, i uploaded the csv list with different email address. and when i upload to mailchimp, and sent. it ends up sending two emails.

In this case, how should i handle it?
0
i have subscription website that I want to auto debt our customer e.g. $5.00 per month and make the charge on every 1th of the month.
can paypal or other provider can do it? if yes, can you please show me their api how it works in c#? thanks
0
I have searched on Google about creating view without controller but most of them shown me I can do it using redirect so I try out.

the result is because the app redirect so many time n it ends up it time out or generate error message.

if you have the same situation please show me how to handle this.

the reasons we don't want to use controller is because we will create many landing page from our web designer. and there is no need to generate any model, but we do want to use cshtml to do some server side work.

thanks
0
i have  @Html.Partial("~/Views/Shared/_ListingsSubEvent.cshtml", "13") on razor
how to capture the value(13) on _ListingsSubEvent.csthml?
0
I have list of pictures for each product in the file folder. all are jpg

1. how can I add text eg. product name in the center of the picture and link them together like a slide show.

2. after that , I hope to create a file as mp4

is that possible written in c# ?

thanks
0
Need Sitecore and .NET MVC practice site

I will be placed on a client location in a few weeks and at that time will be granted access to the existing Sitecore database. Until then, I need some hands on practice with Sitecore.

First, what is the correct term for a Sitecore file? It's not a database, but what term do you use to describe it?

I will be using Sitecore with .NET C# MVC.

I have Visual Studio installed and SSMS, but may need to put on SQL Server as well.

What can you suggest? I will also have no access to the source code until I am at the client location, so I just need something akin to a sandbox where I can play around. An existing, working MVC site with an integrated Sitecore demo database would be best.

What can you suggest?

Thanks
0
Tips to mastering Sitecore

I have a rare opportunity to invest lots of time into learning Sitecore, in preparation for a job integrating Sitecore with a .NET MVC application. So, the more I learn now, the further I can go in implementing Sitecore.

What videos and topics can you suggest I did into to make the most out of this one month deep dive into Sitecore.

And what related technologies might I also consider?

Thanks
0
i have the following codes, and everything is working except the outhtml's size is too big but i do not know how big.
so I added some settings on webconfig but it is till not working.
Can you share with me whatelse I need to do to max the size of accepting data size?
[HttpPost]
        public JsonResult GetAgingReport(string invoicestartandenddate, string receiptstartandenddate, string chargecode)
        {
             
            Domain.Accounting.Report r = new Domain.Accounting.Report();             
            r.invoicestartdate = invoicestartdate;
            r.invoiceendate = invoiceenddate;
            r.receiptstartdate = receiptstartdate;
            r.receiptenddate = receiptenddate;
            r.chargecode = chargecode;
    
            MasterController.ServiceAccounting sa = new MasterController.ServiceAccounting();
            List<Domain.Accounting.Report> agingInDetail= sa.AgingInDetails(r);
            string returnStrInHTML = sa.AgingInDetailsInHTML(agingInDetail);
       
             r.outputHTML = returnStrInHTML;
            return Json(r, JsonRequestBehavior.AllowGet);
        }

Open in new window

  $.ajax({
                url: "/Accounting/GetAgingReport",
                datatype: "text",
                data:
                {
                    'invoicestartandenddate': invoicestartandenddatevalue,
                    'receiptstartandenddate': depositstartandenddatevalue,                   
                    'chargecode': chargecodevalue
                },
                type: "POST",
                success: function (data) {
                    var id = data.outputHTML;
                    alert("Success");
                         
                },
                error: function (error) {
                    alert("Error " + error);

                }
            }); 

Open in new window

 <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.6.1" executionTimeout="100000" maxRequestLength="214748364" />
  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.webServer>
     <security>
      <requestFiltering>
        <requestLimits  maxAllowedContentLength="2147483647"  />
      </requestFiltering>
    </security>
  </system.webServer>

Open in new window

0
i have very common mvc razor web app. and I want to create view without controller and also without using new folder.
I will have one folder called catchall, and I want all view that without controller stay inside of the catchall folder.

Is it possible? and how to do it?

Thanks
0
What .NET Technologies in a New MVC Application?

If you needed to architect a new  .NET MVC Application today, what would it consist of?

What version of .NET, MVC, might it be?
And what about Dependency Inversion?
What about Unit Testing?
What is your preferred Unit Test Framework?
What about AutoMapper?
How about a MOQ tool?

And what else am I forgetting to mention?

Thanks
0
Web URL re-routing and questions about HTAccess

I have used HTAccess (originated with Apache) a few years ago on an MVC site to re-route the URL and am posting a few questions about how to do this today.

1) Is HTAccess still a viable option for web URL re-routing?
2) Is there a different way for a .NET MVC to get this capability?
3) Does HTAccess re-route WITHOUT needing a recompilation?
4) Is this considered "URL re-writing"?

Thanks
0
I have a website and try to track client IP to locate his/her for better information tracking.
we use c#/mvc/razor.

any suggestions on what we can use?

Thanks
0
i use @HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) but it does not read https. it read http only. how to fix it?
0
I'm using Visual Studio 2017 with C#.
I want a user to input some letters into a textbox.  A model maps each letter to a number and returns the total.  how can I display the result (Total variable in the model) in a text area in the same view?

Home Controller
public ActionResult Cards()
        {
            return View();
        }
        public ActionResult Cards(CardModel C)
        {
            C.GetScore(C.Deck);
            return View();
        }

Open in new window


Cards View
@{
    ViewBag.Title = "Cards";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>

<h2>Cards</h2>

    <h2>Please enter a number</h2>

      First name: <input type="text" name="Deck"><br>
      <textarea id="TextArea1" rows="2" cols="20"></textarea>
    <input type="submit" value="Submit">

Open in new window


Model
 public class CardModel
    {
        public string Deck { get; set; }
        public int GetScore(string s)
        {
            int score = 0;
            int totalScore = 0;
            string individualCard = "";
            //loop through each letter in string and convert to a number.
           return Total
}
}

Open in new window

1
I have mvc / razor app using ajax to make some transactions. everything is working fine.
But just we will add more parameters in data and It is going to super long list. so I want to find better way to handle this codes below.
I am thinking using json format passing value from front to the back. but do not know how to do it.

my question is:

1. is it best practice to use json format to pass list of value back and forth? If yes, can you show me how to do it with my codes below?
2. If json is not, can you suggest me what to do?
3. On the end - code behind. I do have lead class. and hope the best will be JsonResult CreateLead(Domain.Lead l) so I do not have to worry too much about list too long.


Thanks


$.ajax({
                                url: "/Home/CreateLead",
                                datatype: "text",
                                data:
                                {
                                    'firstname': document.getElementById("first-name").value,
                                    'lastname': document.getElementById("last-name").value,
                                    'phonenumber': document.getElementById("phone-number").value,
                                    'emailaddress': document.getElementById("email-address").value,
                                    'totalcountadult': document.getElementById("total-count-adult").value,
                                    'totalcountkid': 

Open in new window

0
I have object call Lead and a static method just like email template.
insid of using statement. is it possible to loop the Lead object and get the list of child object?
like this:

body = body.Replace("{displayname}", l.childname);

I have very long list and do not want to type line one by one.

Thank


public static string CreateEmailBody(Domain.Lead l, string templatePath)
        {
            string body = string.Empty;
            using (StreamReader reader = new StreamReader(System.Web.Hosting.HostingEnvironment.MapPath(templatePath)))
            {
                body = reader.ReadToEnd();
            }
            body = body.Replace("{FirstName}", l.FirstName);
            return body;
        }

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain
{
    public class Lead
    {
        [DisplayName("LeadID")]
        public int LeadID { get; set; }
        [DisplayName("Subject")]
        public string Subject { get; set; }
        [DisplayName("FirstName")]
        public string FirstName { get; set; }
        [DisplayName("LastName")]
        public string LastName { get; set; }
        [DisplayName("Email")]
        public string Email { get; set; }
        [DisplayName("MobilePhoneNo")]
        public string MobilePhoneNo { get; set; }
        [DisplayName("LeadStage")]
        public string LeadStage { get; set; }
        

Open in new window

0
Not sure why it always return 0 on last two decimal. like 4.00 5.00... I hope to see 4.23 e.g.

 @{ 
                                decimal totalRate=0;
                                foreach (Domain.Review fReviewItem in rv.ReviewSummary(f))
                                {
                                    totalRate = decimal.Parse(string.Format("{0:F2}",(fReviewItem.TotalRateCount / fReviewItem.TotalReviewCount))); 
                                } 
                                @totalRate;
                            } 

Open in new window

0
Hi Experts,
I have the following code. If the ModelState has error then I want to make the  email textbox red. Please help me how to do it. I am using c# MVC.
Thanks in advance!

@Display(Model.Content)
@using (Html.BeginFormAntiForgeryPost()) {
    @Html.ValidationSummary()
<div class="login-page">
    <h3>@T("Your email address")</h3>
    @Html.TextBox("email", string.Empty, new
    {
        maxlength = 100
    })
</div>


public ActionResult ForgotUserName() {
			var model = _LoginViewModelProvider.GetForgotUsernameViewModel();
			return View(model);
		}


[HttpPost]
		public ActionResult ForgotUserName(string email) {			
			if (!isValidEmail) {
				ModelState.AddModelError("_FORM", T("We're sorry. The information you provided does not match an account in our records."));
				return ForgotUserName();
			}
			
		}

Open in new window

0
I have PDF form that users can fill out and upload into our site.  I capture the fields and write to our database.  
I also allow users to edit the information thru edit forms in our site and allow them to export the PDF Form from our site.

I need to add a signature field to the PDF Form and capture this info if they upload the form.
I also need to allow a user to click a button to "Sign" the record and capture their signature info that I can then export to the PDF Form.

If I could just get my hands on a good example, it would be so helpful!
0
have mvc website that need form wizard step by step. anyone can suggest very simple one to understand?
0
I have a survey website written in mvc so you can image that I have alot of values that need to be captured. and I want to use local storage in javascript.
Is it good idea? I understood local resource has 10 mb as max size.

If you think it is not a good idea, what is the alternative? I do not plan to save them into DB.
0
Hi Experts,
How to find the total item count in the model? If you see the attached image it shows  the count 6. But How to get that number in the code?

Thanks in advance.
img3.png
0
I'm getting an error "Object reference not set to an instance of an object."
on this line in the cshtml
@foreach (var scheme in (List<SchemesMaster>)ViewBag.SchemeList)

to give you an overview:

I have a CSHTML page called paintimage.cshtml
Index.cshtml calls this by having this code   @Html.Action("PaintImage")

then in the homeController.cs  i have
"public ActionResult PaintImage()" which returns a    "return PartialView();"

Inside this code I add lots of stuff to the viewBag
i.e.
ViewBag.CameraID = _imageData.CameraID;

this works fine
However, I need to return a list of items, i've done this in the homecontroller
ViewBag.SchemesList = process.GetSchemes(camera.SiteId);
In the cs file, i can see this is populated fine
But when it gets to the html, its erroring when trying to foreach through the items in the list

what am I missing?
0
Hello,

I am using obout custom control Grid for an application which is in ASP.NET web forms .
I want to replace this obout Grid with any other non-paid alternative control [like ng-grid in angularjs or so]
Can anyone tell how to replace obout Grid control with an alternative one which is equally good. If if yes , can you share an example of the same ?
0
How do i populate a combobox on a MVC VIEW FROM ELEMENTS FROM SQL SERVER DATATABLE USING VB.NET

Thank you
0

.NET MVC

401

Solutions

299

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
>