Tuesday 31 December 2019

Validate Jquery function before form submission in mvc

//////////////////  HTML


     <form id="formIDs">
       <input type="text" name="name" id="inputids">
        <br>
       <button type="button" onclick="SubmitRemarks()">Validate!</button>


     </form>



/////////////////////////// JS

<script type="text/javascript">
    function CalFrmSubmit() {
        if ($("#inputids").val() == "") {
            $("#formIDs").valid();
            Alert("Please select fill input");
            return false;
        }
        else {
            $("#formIDs").submit();
        }
    }
</script>

Tuesday 24 December 2019

Convert Number Month to Name Month Function in sql server

/////////////////////

DECLARE @MyMonth varchar(10)='2'
DECLARE @dates datetime2 = '1900-'+@MyMonth+'-01';

SELECT DATENAME(month, DATEADD(month, @MyMonth-1, CAST('2008-01-01' AS datetime)))[MonthName]

---------- Or
select DATENAME(Month,'1900-'+@MyMonth+'-01')[MonthName]

---------- Or

-------------- or With Fn
SELECT {fn MONTHNAME(@dates)} [MonthName];


SELECT FORMAT(@dates, 'MMMM') AS [MonthName];

---------- Or Culture wise
SELECT
    FORMAT(@dates, 'MMMM', 'en-US') AS 'en-US',
    FORMAT(@dates, 'MMMM', 'es-es') AS 'es-es',
    FORMAT(@dates, 'MMMM', 'de-de') AS 'de-de',
    FORMAT(@dates, 'MMMM', 'en-GB') AS 'zh-cn';

---------- Or Frist 3 char
select left(DATENAME(Month,'1900-'+@MyMonth+'-01'),3)[MonthName]

////////// Result

February

Feb

Convert varchar DD-MM-YYYY or DD/MM/YYYY to YYYY-MM-DD in SQL Query

//////////////////


declare @DateStr varchar(100)=
'13-09-2019' --or '13/09/2019'
or '2019-09-13'
or 


SELECT case when len(isnull(@DateStr ,''))>0 then CONVERT(VARCHAR(10), case when substring(@DateStr ,5,1)='-' or substring(@DateStr ,5,1)='/'then @DateStr else CONVERT(date, @DateStr , 105) end, 23) else null end




//////////////////// Result

2019-09-13 or 
2019-09-13 or  
2019-09-13 or 
NULL

Sunday 15 December 2019

"NetworkError: 404 Not Found fontawesome-webfont.woff2?v=4.7 in mvc

/////////////////// Error




//////////// Solution >> Web.config file >> System.webserver

<system.webServer>
    <staticContent>
      <remove fileExtension=".woff"/>
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
    </staticContent>
  </system.webServer>

Missing Microsoft RDLC Report Designer in Visual Studio 2015,2017,2019

////////////////
Step 1.

     Goto >> Control Panel >> Programs and Features >> Visual Studio --Version >> Change >> Select- Data Storage and Processing >> Sql Server Data Tools





////////////////
Step 2.

Goto Visual Studio >> Tools or Manage Extension >> Update Extension >> Select online >> Search RDLC Report >> Install (Microsoft reporting services project)




////////////////
Step 3.  Goto project >> Project directory >> Add  >> Add New Item >> Search REPORT


Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...