Tag Archives: Image

Image

[RESOLVED]AngularJS in ASP.NET MVC Partial View

I am currently loading Partial View returned by MVC controller to a model dialog via AngularJS $http.get call. My View in rendered properly in modal dialog, but the only problem is that my partial view which is rendered also uses angular expressions etc.
and for some reason angular is not working in my partial view, but if i load this partial view in some other view without ajax call then it angular works properly.

Partial View Code: ~/Views/ArticleType/_Add
MVC Controller: ArticleTypeController

//other scripts files e.g app.js and angular.js are included in main layout file.
<script src="~/Scripts/Angular/ArticleTypeController.js"></script>
<div class="modal-content" ng-controller="ArticleTypeController">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        Add New Article Type
    </div>
    <form novalidate role="form" name="ArticleTypeForm" ng-submit="ArticleTypeForm.$valid && Add(model)">
        <div class="modal-body">
            <div class="form-group">
                <label for="ArticleType" class="control-label">Article Type</label>
                <input type="text" required ng-model="model.ArticleTypeName" class="form-control" id="ArticleType" />
            </div>
        </div>
 
    </form>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary" value="Add" >Add</button>
        {{ArticleTypeForm.$valid}}
    </div>
</div>

Angular Controller to load modal with the partial view.
MenuController.js

angular.module('myApp').controller('MenuController', [
        '$scope', '$http', 'httpPreConfig', function ($scope, $http, httpPreConfig) {
 
            $scope.AddArticleType = function () {
                $.get("/ArticleType/Add")//returns the partial view.
                    .success(function (response) {
                        ShowModal(response);//it properly shows the modal. but angular doesn't work
                    });
            }
        }]);

common.js 

$(document).ready(function (e) {
    
    $(document).ajaxStart(function (e) {
        $("#loadingBar").modal('show');
    });
    $(document).ajaxStop(function(e) {
        $("#loadingBar").modal('hide');
    });
    $(document).ajaxComplete(function (e) {
        $("#loadingBar").modal('hide');
    });
    $(document).ajaxError(function (e) {
        $("#loadingBar").modal('hide');
    });
});
 
function ShowModal(content) {
 
    //var html = $complie(content)(scope);
    $("#modal .modal-dialog").html(content);
    $("#modal").modal("show");
}
function HideModal() {
    $("#modal .modal-dialog").html("");
    $("#modal").modal("hide");
}

AS you can see from the image below that Angular expressions are not working in Modal Dialog. The html of this dialog is returned from MVC Controller whcih returns a partial view. 

Any help would be really appreciated. Just so that you know, angular expressions etc. are working in normal views.

Here is the download link to the solution files. : https://app.box.com/s/rxvrhwcdp75zo736k7u5

Hi asad,

According to your description, it works fine if you load that partial view directly, however it doesn’t work if using the AJAX to load the partial view.

I think you may need to compile HTML string or DOM into a template.

More information, please refer to:

# $compile

https://docs.angularjs.org/api/ng/service/$compile  

There are some threads that may help you:

# AngularJS – Dynamically creating elements that specify directives

http://stackoverflow.com/questions/20025526/angularjs-dynamically-creating-elements-that-specify-directives

# Bind Angularjs to newly created html element dynamically

http://stackoverflow.com/questions/19867554/bind-angularjs-to-newly-created-html-element-dynamically

Best Regards

Starain Chen

[RESOLVED]How to resize image when upload and make bigger the time allow to run scripts

Hi, i got 2 problems

First problem, when users try to upload photos bigger than 1,5 MB i would love to resize the photo to be max 1,5 MB, how to do?

this is the code i use to upload a picture :

if (file != null)
                    {
                        if (file.ContentLength > 0)
                        {

                            var myuploadextension = Path.GetExtension(file.FileName);

                            if (myuploadextension.ToUpper() == ".JPEG" || myuploadextension.ToUpper() == ".JPG" || myuploadextension.ToUpper() == ".BMP" || myuploadextension.ToUpper() == ".PNG" || myuploadextension.ToUpper() == ".GIF")
                        {


                            var sizeMb = (file.ContentLength / 1024f) / 1024f; //file.contentlength is in bytes

                            var todaydate = DateTime.Now.ToShortDateString();
                            var todaydatefriendly = todaydate.ImageFriendly();
                            var myuploadiwthoutextension = Path.GetFileNameWithoutExtension(file.FileName);
                            var myuploadiwthoutextensionfriendly = myuploadiwthoutextension.ImageFriendly();
                            var UserId = User.Identity.GetUserId();

                            var fileName = todaydatefriendly + "-" + UserId + "-" + myuploadiwthoutextensionfriendly + myuploadextension;

                            var path = Path.Combine(Server.MapPath("~/Content/UserCreations"), fileName);
                            file.SaveAs(path);
                            

                            creation.CreationPhotoBis = fileName; 

                            db.Creations.Add(creation);
                            db.SaveChanges();



                        }


                        }
                    }

Second problem, if this upload action tak more the certain time i got a message that i go over my allowed tim for script, how to avoid it? or make this time bigger when upload?

Somebody can help me to implement this code?

Thanks

[RESOLVED]page and ajax

When the page
shows a portion of the content
using
ajax, it
has 2
connection -
to the current page
and the page
requested by ajax?
Likewise with the
iframe? Trying to
optimize your site, but it turns out
that the use of Ajax
only
clog the channel.

It initiates a new connection, but these connections are permanent, they only exist until the content is retrieved.  Use the network section of the browser’s developer tools (f12) and you’ll get to see all the connections your page makes.  It will make a
connection for each image, script file, css file etc too.  If any ajax code runs that will instantiate a connection, as will an Iframe, and any resources (images, script files, css files) used in the iframe will kick off a connection, as will any images etc
referenced by html you return from your ajax call.

[RESOLVED]How to increase ScriptTimeout in MVC5

Hi, i got a problem when i try to upload an image bigger than 4,8 MB, the page goes in time out.. i guess…

error :

[HttpException (0x80004005): Maximum request length exceeded.]

I tryied to add this code in my web.config

<location path="Creation/CreationUpload">
    <system.web>
        <httpRuntime executionTimeout="1000"/>
    </system.web>
</location>

but it does not work

this is the code in my controller :

// POST: /Creation/CreationUpload
        // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour 
        // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [Authorize]
        [ValidateAntiForgeryToken]
        public ActionResult CreationUpload([Bind(Include = "CreationId,CreationTitle,CreationPhotoBis")] Creation creation, IEnumerable<HttpPostedFileBase> files)
        {
            if (ModelState.IsValid)
            {
               
                
                // update each field manually
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        if (file.ContentLength > 0)
                        {

                            var myuploadextension = Path.GetExtension(file.FileName);

                            if (myuploadextension.ToUpper() == ".JPEG" || myuploadextension.ToUpper() == ".JPG" || myuploadextension.ToUpper() == ".BMP" || myuploadextension.ToUpper() == ".PNG" || myuploadextension.ToUpper() == ".GIF")
                        {


                            var sizeMb = (file.ContentLength / 1024f) / 1024f; //file.contentlength is in bytes

                            var todaydate = DateTime.Now.ToShortDateString();
                            var todaydatefriendly = todaydate.ImageFriendly();
                            var myuploadiwthoutextension = Path.GetFileNameWithoutExtension(file.FileName);
                            var myuploadiwthoutextensionfriendly = myuploadiwthoutextension.ImageFriendly();
                            var UserId = User.Identity.GetUserId();

                            var fileName = todaydatefriendly + "-" + UserId + "-" + myuploadiwthoutextensionfriendly + myuploadextension;

                            var path = Path.Combine(Server.MapPath("~/Content/UserCreations"), fileName);
                            file.SaveAs(path);

                            //Language
                            var actualculturetocheck = "en";
                            var actualculture = this.Session["ActualCulture"];
                            if (actualculture != null)
                            {
                                actualculturetocheck = actualculture.ToString();
                            }

                            
                            //Ipaddress
                            var ipAddress = Request.ServerVariables["REMOTE_ADDR"] + " " + Request.UserHostAddress;

                            creation.UserId = User.Identity.GetUserId();
                            creation.CreationLanguage = actualculturetocheck;
                            creation.CreationVisible = true;
                            creation.CreationDelete = false;
                            creation.CreationDate = DateTime.Now;
                            creation.CreationIpAdress = ipAddress;
                            creation.CreationPhotoBis = fileName; //after add

                            db.Creations.Add(creation);
                            db.SaveChanges();



                        }


                        }
                    }
                }

                //UserId
                return RedirectToAction("CreationList", "Creation", new { UserId = User.Identity.GetUserId() });
            }

            return View(creation);
        }

what should i do to increase the ScriptTimeout in my contorller action?

FULL ERROR WHEN I TRY TO UPLOAD :

[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +9553280
   System.Web.HttpRequest.GetMultipartContent() +63
   System.Web.HttpRequest.FillInFormCollection() +165
   System.Web.HttpRequest.EnsureForm() +75
   System.Web.HttpRequest.get_Form() +12
   System.Web.HttpRequestWrapper.get_Form() +9
   System.Web.Mvc.HttpRequestExtensions.GetHttpMethodOverride(HttpRequestBase request) +121
   System.Web.Mvc.AcceptVerbsAttribute.IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) +37
   System.Web.Mvc.HttpPostAttribute.IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) +39
   System.Web.Mvc.ActionMethodSelectorBase.IsValidMethodSelector(ReadOnlyCollection`1 attributes, ControllerContext controllerContext, MethodInfo method) +54
   System.Web.Mvc.ActionMethodSelectorBase.RunSelectionFilters(ControllerContext controllerContext, List`1 methodInfos) +124
   System.Web.Mvc.ActionMethodSelectorBase.FindActionMethods(ControllerContext controllerContext, String actionName) +142
   System.Web.Mvc.ActionMethodSelectorBase.FindActionMethod(ControllerContext controllerContext, String actionName) +104
   System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor.FindAction(ControllerContext controllerContext, String actionName) +54
   System.Web.Mvc.ControllerActionInvoker.FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, String actionName) +16
   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +114
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
   System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +468
   System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +18
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +20
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +374
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +16
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__3(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +52
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +384
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Thanks

grafic.web

[HttpException (0x80004005): Maximum request length exceeded.]

This error is related to the size of the uploaded file. You need to increase the Request length

 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>

For IIS versions older than 7 use this

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

If you are going to be working with files that are larger than the default of 4MB, you’ll need to update the maxRequestLength within your
web.config to handle files of that size. This can be handled within the <system.web> section of your web.config or the <system.webServer> section if you want to handle it at the IIS level (both are probably a good idea).

It’s important to know that maxAllowedContentLength is measured in bytes and maximumRequestLength is measured in kilobytes when settings these values so you’ll need to adjust them accordingly if you plan on handling much larger files : 

<configuration>
    <system.web>
        <!-- This will handle requests up to 30MB -->
        <httpRuntime maxRequestLength="30720" timeout="3600" />
    </system.web>
</configuration>

<!-- IIS Specific Targeting (noted by the system.webServer section) -->
<system.webServer>
   <security>
      <requestFiltering>
         <!-- This will handle requests up to 30MB -->
         <requestLimits maxAllowedContentLength="31457280" />
      </requestFiltering>
   </security>
</system.webServer>

If you don’t see these sections within your existing web.config file, you’ll simply need to copy them in.

[RESOLVED]How to chek why my website is long to be downloaded and what to do to decrease this time

Hi, i notice that my web site takes more time to be downloaded if i compare with other sites with same amounth of images…

How can i find what make my site long to be downloaded?

And how to fix?

Thanks

I believe the issue here is likely related to the physical sizes of your images, which can take quite some time to download if they are extremely large.

You’ll want to ensure that the image matches the size of the container you are intending to place it in and that the image has been optimized (to help reduce the size of it). When you see this occurring on a site, it is typically because the image
that is being loaded is :

  • The image(s) may be too large (for example a 800×800 image being loaded into a 100×100 container requires the browser to do lots of unnecessary work)
  • The image(s) are not optimized (you can use several online compressors like Smush.It or Kraken.io to optimize your images online)
  • The image(s) are physically quite large (this can depend on the types of files being uploaded, as files like bitmaps are extremely large).

Optimizing your images will likely help this issue tremendously. If you want to look at these requests, consider using the Developer Tools (F12) within Chrome and checking out the Network tab which will allow you to see each of your AJAX requests that are
made and their sizes.

Consider Using a Third-Party Analyzer

I would recommend running something an analyzer like one of the following on your site :

  • Using Google PageInsights - Google’s PageInsights can help you find areas of improvement and offers suggestions on how to get your site running faster.
  • Using Yahoo’s YSlow Analyzer - Very similar to Google’s PageInsights, YSlow looks for areas that you can check to improve the performance of your site.

It will provide you with any major concerns that might be slowing down performance on your site and how to resolve these issues. You might see something like the following after running it, which will let you know what images you need to consider optimizing
and the amount of size that you will save :

One Final Recommendation

If you want an excellent resource that encompasses a variety of methods to improve your website or web application, I cannot recommend the Web Developer Checklist enough. There
is also an ASP.NET-specific version available on the site as well
 and one that focuses specifically on ASP.NET Performance. It’s probably one of the best single resources that I have found for
improving nearly all aspects of a website or web application.

[RESOLVED]how can i use url.action in @helper method ?

Hi dear ,

 I create a @helper method and use @Url.Action helper in it.(in App_Code Folder)

@helper GetNews(int CategoryID, int Rows)
{
         <div class="@Style" id="@CategoryID">
         
                  <a style="padding-right:10px" href="@Url.Action("Rss", "Home", new { type="News" , cid = CategoryID})"><img src="@Url.Content("~/images/icon/rss.png")" /></a>
                                &nbsp;
                                <a href="@Url.Action("Details", "News", new { cid=CategoryID,sid=Model})">arshive</a>
                             </div>
                        
}

after run i get an error :

Compilation Error 
  Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

 Compiler Error Message: CS0103: The name 'Url' does not exist in the current context

Source Error:


 

Line 193:                                </table>*@
Line 194:
Line 195:                                <a style="padding-right:10px" href="@Url.Action("Rss", "Home", new { type="News" , cid = CategoryID})"><img src="@Url.Content("~/images/icon/rss.png")" /></a>
Line 196:                                &nbsp;
Line 197:                                <a href="@Url.Action("Details", "News", new { cid=CategoryID,sid=Model})">arshive</a>
 

Also,
I had
to have
a class named ExtensionMethodHelper
for create external helpers and use it ( in Model folder ).but i
can not call
this
external helpers on the page(.cshtml) that
I’ve created
in
App_Code folder.

in fact after write @Html.  i dont find my favorite external helper (in ExtensionMethod class in Model folder).

for e.g : Html.PersianDate made in ExtensionMethodHelper in Model Folder

   <span class="date">@Html.ToPersianDate(item.DateToShow)</span>

in :

below helper create in App_Code

@helper GetNews(int CategoryID, int Rows)
{
       <div class="@Style" id="@CategoryID">
                <a style="padding-right:10px" href="@Url.Action("Rss", "Home", new { type="News" , cid = CategoryID})"><img src="@Url.Content("~/images/icon/rss.png")" /></a>
                       &nbsp;
                   <a href="@Url.Action("Details", "News", new { cid=CategoryID,sid=Model})">arshive</a>
       </div>
                        
}

 how can i solve it

please help me

thanks

I use the "UrlHelper" class to do this.  Here’s a helper I always used in my projects (prior to bundles).  Use it as an example to expand on your own:

// file name is "Content.cs" stored in App_Code folder

@using System.Web.Mvc; @helper Script(string scriptName, UrlHelper url) { <script type="text/javascript" src="@url.Content("~/Scripts/" + scriptName)"></script> }

the helper in my View then looks like:

@Content.Script("jquery-1.10.1.min.js", Url)

You can see that I pass the "Url" to the helper.  Your helper would then look like…

@helper GetNews(int CategoryID, int Rows, UrlHelper url)
{
  ...

  <a href="@url.Action("Rss", "Home", ...)">

  ...
}

the "url" is lowercase fyi.  Don’t confuse it with Url

[RESOLVED]Not able to get name of the image button on Controller side

Hello There, 

I am new to MVC and facing lot of issues :(

I have one image, acting as a button, when I clicked on it, it post back, but not able to find its name in Action. Here is my code snippet

View :-

@using (Html.BeginForm())
{

<input type="image" value="AddRoutine" name="button" src="~/Images/Add.png" id="imgAdd" title="Add" alt="Add" />

}

Controller :- 

[HttpPost]
public ActionResult Index(string button)
{
          // the parameter "button" is always comes null 

it is working fine when I use input type button instead of image 

Where I am doing mistake, what is the problem with input type image ?

Please help me out 

Thanks
Ash

An input type="image" is not an input that can carry a value to the server

try this

<button type="submit" value="AddRoutine" name="button" >
	
    <img src="~/Images/Add.png"  title="Add" alt="Add"/>
	
</button>

thats because the image posts two values containing the x & y positions. name.x and name.y. so you need an object:

public class ImageValue
{
   public int x {get; set;}
   public int y {get; set;}
}

[HttpPost]
public ActionResult Index(ImageValue button)
{

} 

[RESOLVED]Convert ajax call into chunked calls of 100 for a URL

Excuse me here, I’m rather new to this, so please bear with me.

I have been given the task as stated in the subject, to break the ajax call into chunks of 100.  This is being done as to not run out of URL space.  My instinct (which is probably wrong) is to pass it through as an array.  This is where I’m hitting a wall.
 Here is a chunk of code in the index of Views.

$(document).ready(function() {
var imageNos = ‘@Model.ImageNos’;
var array = imageNos.split(‘,’);

var oTable = $(‘#imageTable’).dataTable(
{
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "ImageData/GetList",
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bJQueryUI": true,
"aoColumns": [
{ "bSortable": false, "bSearchable": false },
null,
null,
null,
null,
null,
null,
null
],
"fnServerData": function(sSource, aoData, fnCallback) {
aoData.push({ "name": "ImageNos", "value": array });
$.getJSON(sSource, aoData, function(json) {
fnCallback(json)
});
},
"fnRowCallback":function(nRow, aaData) {
var imageno = aaData[1];
$.get("ImageData/ImageDetails?imageNo=" + imageno, function (details) {
oTable.fnOpen(nRow, details, ‘details’);
});
return nRow;
}
});

here is how I;m trying to pass it through to the controller.

public ActionResult GetList(string[] value)
{
var imageNos = new List<long>();
try
{
if (!string.IsNullOrEmpty(value))
{
/*var imgs = ImageNos.TrimEnd(‘,’).Split(‘,’).ToList();
imageNos.AddRange(imgs.Select(i => Convert.ToInt64(i)));*/
}

long totalImages;
var images = ImageRepository.GetSelectedImages(imageNos);
var imageDataModels = images as IList<ImageDataModel> ?? images.ToList();
return Json(new
{
iTotalRecords = imageDataModels.Count,
iTotalDisplayRecords = imageDataModels.Count,
aaData = imageDataModels.Select(x => new[]
{…………

As it is now, I’m getting errors

Error 1 The best overloaded method match for ‘string.IsNullOrEmpty(string)’ has some invalid arguments and 

Error 2 Argument 1: cannot convert from ‘string[]’ to ‘string’ 

I know this is a lot of code, and i’m not even sure I have posted anything that could help someone assist me, but any help on this would be greatly appreciated; I’m feeling a bit overwhelmed and underwater.

edit: I meant to say beforehand that everything works fine before I try the array above, before I split it in the index

I can’t really follow what the code is doing, but you’re getting that error as

string.IsNullOrEmpty(value)

in the above "value" is an array, and IsNullOrEmpty works on strings, not arrays of strings.  If you want to check if an array isn’t empty try

if (value != null && value.Length >0)

Not saying that’s going to fix your issue, but it will get your code to compiled.  Also if you’re worried about "running out of url space" then just POST your data rather than using GET and you don’t need to worry.

[RESOLVED]Model state still returns false after I make changes as per the required validations.

My Model state still returns false after I make changes as per the  required validations.

 [HttpPost]
        public ActionResult InsertProject(Project project, HttpPostedFileBase ImageFile = null)
        {

            project.RegistrationId = 1;//Testing
            if (ModelState.IsValid)
            {
                if (ImageFile != null)
                {
                    project.ImageType = ImageFile.ContentType;
                    project.Image = new byte[ImageFile.ContentLength];
                    ImageFile.InputStream.Read(project.Image, 0, ImageFile.ContentLength);
                }
                repository.InsertProject(project);
                return RedirectToAction("List");
            }
            
            return View();
        }

This is part of my view

@using (Html.BeginForm("InsertProject", "Project", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    if (ViewData.ModelState.Keys.Any(k => ViewData.ModelState[k].Errors.Count() > 0))
    { 
   <div class="alert alert-warning">@Html.ValidationSummary()</div>
    }

So when user inputs wrong data, validation summary shows up. After making the required changes when user submits the form, the model state is still invalid. I’m pretty new to mvc. Could you please guide me.

Thanks,

Rose

Show also the Project class code. Which validators you have on it? 

 
@OP: I didn’t answer the question, I only asked to show code around Project class. Please unmark my post as an answer, If your problem is solved then you can update the post.

Yes..Show also the Project class code. Which validators you have on it? this will help us to understand the actual reason for Failing your required field.