Skip to main content

Posts

Showing posts from February, 2014

MVC razor table row date to compare date between other 2 date in javascript

Consider the senerio of the image that i want to select date from table row date and my selected date will check other 2 date between in javascript. First i am getting the event of date change: </td> <td class="rptrowdata" align="center" style="width: 65px"> @{ if (Model.EmployeeInformationList[i].OutGoingDate == DateTime.MinValue || Model.EmployeeInformationList[i].OutGoingDate == null) { @Html.TextBoxFor(m => m.EmployeeInformationList[i].strOutGoingDate, new { @class = "textRegular dtPicker pmtallocated pull-right", @readOnly = "readOnly", maxlength = "10",@dir = "rtl",@onchange = "return DateChecker(this);" }) } else { <input type="hidden" value="@Model.EmployeeInformationList[i].Out

mvc controller post action not working

some times we see that the post is not work, like as button or other. we can manage it using form and script to serialize the form to reach our controller action. define your action path, form id and method type in your form. <form id="subscriptionForm" action="/Category/Create" method="post">   <div class="form-horizontal"> <h4>PIS_tblCategory</h4> <hr /> @Html.ValidationSummary(true) <div class="form-group"> <div class="form-group"> @Html.LabelFor(model => model.CategoryName, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.CategoryName) @Html.ValidationMessageFor(model => model.CategoryName) </div> </div> <div class="form-group"> @Html.LabelFo

asp.net mvc how to separate module wise controller, model, view

First take a look on this. http://stackoverflow.com/questions/5243158/how-to-configure-areas-in-asp-net-mvc3 In ASP.NET MVC application MVC gives use 3 part Controller, Model & View . But if we want to separate the  Controller, Model & View as our application Module based we can also implement this using AreaRegistration . Consider i want to use PIS module with seperated Controller, Model & View . i have to add a user define class, i just named it PISAreaRegistration . public class PISAreaRegistration : AreaRegistration { public override string AreaName { get { return "PIS"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "PIS_default", "PIS/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } } if you

mvc razor selected datepicker will add 3 month in another datepicker

  Before select date  after select date if you want to select any date from a date picker and it will add 3 month / as your self  in another date picker, you can easily do it using script on change event of you first date picker. @Html.TextBoxFor(m => m.MaternityLeave.strSymptomDate, new { @class = "textRegular requiredSub dtPicker", @readOnly = "readOnly", maxlength = "10", onchange = "return getConfirmationDate();" }) second date picker @Html.TextBoxFor(m => m.MaternityLeave.strApplyDate, new { @class = "textRegular requiredSub dtPicker", @readOnly = "readOnly", maxlength = "10" }) on change event script function getConfirmationDate() { var confirmOld = $("#MaternityLeave_strSymptomDate").val(); var mySplitResult = confirmOld.split("-"); var confirm_date = mySplitResult[0].toString(); var confirm_month = parseFloat(mySplitResult[1].t

sql datetime in join condition

In sql join on date or other query we fall common problem of time span. we can easily remove that to convert the date in to var-char & date format code 106 in sql. LEFT JOIN Payroll_tblEmployeeLeave ON PIS.dbo.PIS_tblEmployeeGenInfo.GEmployeeGenInfoID=Payroll_tblEmployeeLeave.GEmployeeGenInfoID and Convert(varchar(11) ,Payroll_tblEmployeeLeave.LeaveDate,106 )=''' + Convert(varchar(11),@OfficeLeaveDate,106 ) + '''