Categories
Mastering Development

MVC (Entity framework) Saving ID changes from “Create View” to SQL database table

I need solution for my problem. Got 1 database with 3 tables (with primary keys and identity (1,1) and 3 foreign keys) I will post diagram bellow. My dropdown lists are connected if I choose Country it will just list me states from that country. What I want to do is when i pick Country […]

Categories
Database Development

Datatable Which is Already Fill from Database add new Record from textbox value on click

@model Desai.Model.Bill_Master @{ ViewBag.Title = "Bill Details"; if (Session["Date"].ToString() != DateTime.Now.Date.ToString()) { Response.Redirect("~/Login/Index"); } } .marge { margin-bottom: 6px; } .content { min-height: 0px; padding: 0px; padding-top: 10px; margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } .input-group { float: Left !important; padding-right: 10px !important; padding-left: 0px; } .bill-Total { float: right !important; } .addNew […]

Categories
Mastering Development

Date DataAnnotation validation attribute not working – shows the time

Not working. Date comes back from a database field. Shows as: When it is not set from a database as there is no birth date, I get a little red dot top left. Shows as: I don’t want the time included. I have a data annotation display format but it does not seem to take […]

Categories
Mastering Development

How can I update image in asp.net mvc?

I have a table which contains the path of image. In controller I have this method public string uploadimage(HttpPostedFileBase file) { Random r = new Random(); string path = “-1”; int random = r.Next(); if (file != null && file.ContentLength > 0) { string extension = Path.GetExtension(file.FileName); if (extension.ToLower().Equals(“.jpg”) || extension.ToLower().Equals(“.jpeg”) || extension.ToLower().Equals(“.png”)) { try […]

Categories
Development

ASP.NET wrong model type

I’m working on a website and I’m struggling with the Models I pass to my Views. I ended up testing if it worked in the most basic way to be sure I hadn’t done something obviously wrong. Still doesn’t work : My Controller : public class HomeController : Controller { public ActionResult Test() { List<Model_Test> […]

Categories
Development

Fix A potentially dangerous error with using text editor form

I’m using ck editor for my form ck editor send <p> tag and I receive A potentially dangerous Request.Form value was detected from the client (title=<p>efrgth</p> error code in form: <div class=”form-group”> @Html.LabelFor(model => model.title, htmlAttributes: new { @class = “control-label col-md-2″ }) <div class=”col-md-10″> <textarea id=”content” name=”title” class=”ckeditor form-control” dir=”rtl”></textarea> @Html.ValidationMessageFor(model => model.title, “”, […]

Categories
Development

Issue With Login and Registration in asp.net mvc?

I m a student I m Learning MVC. I have only one table for login and registration. problem is login is not working as well as registration is not work stanstuds.cs public class stanstuds { [Key] public int id { get; set; } public string fname { get; set; } public string mname { get; […]

Categories
Development MVC

MVC4 Form Validation not working except from Email validation

I am building an MVC4 application, but none of the following Form Validation is working, except for the Email ID one. username and passwords that do not fulfill the minimum requirement can still get registered. Registration is getting dome even if the password and confirm password don’t match. Can someone please help? using System.Collections.Generic; using […]

Categories
ASP.NET Development MVC

asp.net javascript mvc – how can I get javascript from inner page to clear element from outer page?

I want javascript click event that’s called from an “inner” mvc form to clear the element of the “outer”/”parent” form but clicking clear produces no results (see wireframe). Javascript works on the outer form but not when called from scripts file reference in the inner form although I know that the script is wired up […]