Wednesday 6 February 2019

Disable Roslyn exe asp.net project visual studio 2015 and visual studio 2017

Monday 19 December 2016

Jquery Learn

Jquery learn by given below link

https://www.codeproject.com/Articles/39242/Getting-friendly-with-jQuery

Wednesday 1 April 2015

MVC DROPDOWNLIST





                             MVC DROPDOWNLIST


@Html.DropDownList("SchProductLevel-" + Row + "", new SelectList(Model.ProductTypeMstList, "ProdTypeId", "ProdTypeName", item.ProdLevelId), "--Select--", new { id = "EditSchProductLevel-" + Row + "", @class = "EditSchClassProductLevel form-control EditContClassddlProd" })

@Html.DropDownList("PackageType", (SelectList)ViewBag.Package, new { id = "ddlQueryType", @class = "form-control" })

@Html.DropDownList("ddlSchemeType", new SelectList(Model.SchemeTypeList, "SchemeTypeId", "SchemeName", Model.SchemeMaster.SchemeType.ToString()), "--Select--", new { @class = " form-control" })


@model  SchemeSetup.Models.SchemeModel
@{
    var prodNamelist = Model.SchProductList.Select(n => new { n.ProdName,n.ProdLevelId }).ToList();
    var aaa = new List<string>();
    var temp = 0;
}
 @{aaa = prodNamelist.Where(x => (x.ProdLevelId == item.ProdLevelId)).Select(n => n.ProdName).ToList();}
 @Html.DropDownList("ddlProdR-" + Row + "", new MultiSelectList(BusinessLayer.SchemeMasterManager.GetProdBased(item.ProdLevelId), "Id", "Name",@aaa), new { @class = "form-control ddlProdR", @multiple = "multiple" })

Monday 23 March 2015

Date format check

Date format check





 public static string ToMyDateTime(DateTime dateTime)
        {
            return dateTime.ToString("dd/MM/yyyy");
        }

        /// <summary>
        /// This method is used to check if the specified expression is a valid date.
        /// This function checks the specified string against MM/DD/YYYY format.
        /// </summary>
        /// <param name="expression">Expression to be checked.</param>
        /// <returns>true if the specified expression is a valid date, false otherwise.</returns>
        public static bool IsValidExectDate(string expression)
        {
            bool bResult = true;

            if (expression == null || expression.Length < 8 || expression.Length > 10)
            {
                bResult = false;
            }
            else
            {
                try
                {
                    string[] expressionArray = expression.Split('/');
                    expression = expressionArray[0].PadLeft(2, '0') + "/" + expressionArray[1].PadLeft(2, '0') + "/" +
                                 expressionArray[2].PadLeft(2, '0');
                    DateTime.ParseExact(expression, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                }
                catch (Exception)
                {
                    bResult = false;
                }
            }

            return bResult;
        }


        /// <summary>
        /// This method is used to check if the specified expression is a valid date.
        /// This function checks the specified string against global date format.
        /// </summary>
        /// <param name="expression">Expression to be checked.</param>
        /// <param name="expression">Global date format.</param>
        /// <returns>true if the specified expression is a valid date, false otherwise.</returns>
        public static bool IsValidExactDate(string expression, string dateFormat)
        {
            bool bResult = true;

            if (expression == null || expression.Length < 8 || expression.Length > 10)
            {
                bResult = false;
            }
            else
            {
                try
                {
                    //expression = expression.Replace('-', '/');
                    string[] expressionArray = expression.Split('/');
                    expression = expressionArray[0].PadLeft(2, '0') + "/" + expressionArray[1].PadLeft(2, '0') + "/" +
                                 expressionArray[2].PadLeft(2, '0');

                    DateTime.ParseExact(expression, dateFormat, CultureInfo.InvariantCulture);
                }
                catch (Exception)
                {
                    bResult = false;
                }
            }

            return bResult;
        }

        /// <summary>
        /// This method is used to check if the specified expression is a valid datetime.
        /// This function checks the specified string against global datetime format.
        /// </summary>
        /// <param name="expression">Expression to be checked.</param>
        public enum DateTimeFormat
        {
            /// <summary>
            /// Use this when you need DateTime to be converted into Date in MMDDYYYY format.
            /// </summary>
            DateMMDDYYYY,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date in MMDDYY format.
            /// </summary>
            DateMMDDYY,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date in DDMMYYYY format.
            /// </summary>
            DateDDMMYYYY,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date in DDMMYY format.
            /// </summary>
            DateDDMMYY,

            /// <summary>
            /// Use this when you need DateTime to be converted into Time in 12 hours clock format.
            /// </summary>
            Time12HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Time in 24 hours clock format.
            /// </summary>
            Time24HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in MMDDYYYY format and Time in 12 hours clock format.
            /// </summary>
            DateMMDDYYYYAndTime12HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in MMDDYY format and Time in 12 hours clock format.
            /// </summary>
            DateMMDDYYAndTime12HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in DDMMYYYY format and Time in 12 hours clock format.
            /// </summary>
            DateDDMMYYYYAndTime12HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in DDMMYY format and Time in 12 hours clock format.
            /// </summary>
            DateDDMMYYAndTime12HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in MMDDYYYY format and Time in 24 hours clock format.
            /// </summary>
            DateMMDDYYYYAndTime24HoursClock,

            /// <summary>
            /// Use this when you need DateTime to be converted into Date and Time, with Date in MMDDYY format and Time in 24 hours clock format.
            /// </summary>
            DateMMDDYYAndTime24HoursClock,

            /// <summary>
        }
    }

Tuesday 20 January 2015

Set Selected value of checkbox in multiseleted dropdown

Set Selected value of checkbox in multiseleted dropdown





var valArr = [101,102];
i = 0, size = valArr.length;
for(i; i < size; i++){
  $("#data").multiselect("widget").find(":checkbox[value='"+valArr[i]+"']").attr("checked","checked");
  $("#data option[value='" + valArr[i] + "']").attr("selected", 1);
  $("#data").multiselect("refresh");
}

Monday 8 December 2014

Code Behind alert message in c#

                          Code Behind alert message in c#






 var message = new JavaScriptSerializer().Serialize(ex.Message.ToString());
                var script = string.Format("alert({0});", message);
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "", script, true);

Wednesday 19 November 2014

Numeric Validation Using Jquery


                             Numeric Validation Using Jquery


$(".numeric").keypress(function () {
            debugger;
            // Allow only backspace and delete
            if (event.keyCode == 46 || event.keyCode == 8) {
                // let it happen, don't do anything
            }
            else {
             
                // Ensure that it is a number and stop the keypress
                if (event.keyCode < 48 || event.keyCode > 57) {
                    event.preventDefault();
                    alert('Enter only numeric value.');
                }
            }
        });
     
    });