Thursday, September 29, 2022

excel bullet points - Add bullet points in Excel

 Alt + 7  and Alt + 0149

Alt + 9

Error in ASP.Net Application - Cannot continue the execution because the session is in the kill state


 

Taking screenshot and video recording in windows with xbox - print screen xbox capture screenshot video recording capturing

 window key + alt + print screen - for print screen

window key + alt + G

window key + alt + R --------- for recording

window key + print screen ------------ for print screen and saved into (C:\Users\TAC\Pictures\Screenshots)

print screen for taking screenshot in windows but file will not be saved.

Wednesday, September 28, 2022

Redirect to different page in ASP.NET C# - meta

  HtmlMeta meta = new HtmlMeta();


                            meta.HttpEquiv = "Refresh";


                            meta.Content = "2;url=StudentList.aspx";


                            this.Page.Controls.Add(meta);



---------------------



redirecting of page from one to another with meta



 protected void btn_cancel_Click(object sender, EventArgs e)

    {


        #region redirectbtmeta

        HtmlMeta meta = new HtmlMeta();


        meta.HttpEquiv = "Refresh";


        meta.Content = "1;url=StudentList.aspx";


        this.Page.Controls.Add(meta);

        #endregion

      

        

    }

Tuesday, September 27, 2022

File view on click in new tab with javascript with icon - Javascript PDF file view

  <tr>

                                  <td>

                                      Updated List of NSQF Compliant ESDM Courses as on 15th September 2020

                                  </td>

                                  <td>

                                   <a href="javascript:void(0);" onclick="javascipt:window.open('Document/Admin/Updated_List_NSQF_ESDM_Course_150920.pdf');" target="_blank"><img src="images/pdf_sm_icon.png" alt="" align="absmiddle" /> Download</a>

                                  </td>

                              </tr>

                              <tr>

Monday, September 26, 2022

Website with good asp.net examples

 http://www.codedigest.com/


https://7explications.wordpress.com/

ASP.NET URL mapping from main.aspx to main

  <system.web>

   <urlMappings enabled="true">

      <add url="~/main" mappedUrl="~/main.aspx"/>

    </urlMappings>

  </system.web>

Session timeout in asp.net C#

<system.web>

<sessionState timeout="60" mode="InProc" cookieless="true" regenerateExpiredSessionId="true"/>

 </system.web>


or


<noscript>

    <meta http-equiv="refresh" content="0;url=Logout.aspx">

</noscript>

<html>



protected void Page_Load(object sender, EventArgs e)

    {

        HtmlMeta meta = new HtmlMeta();

        meta.HttpEquiv = "Refresh";

        meta.Content = Convert.ToString(Session.Timeout * 60) + ";url=Logout.aspx";

        this.Page.Header.Controls.Add(meta);

     



        Page.Title = ":::ESDM ADMIN:::";


        try

        {

            if (Session["adminsession"] != null && Convert.ToString(Session["adminsession"]).Length > 1)

            {


                if (Session["admincookiessession"] != null && Session["admincookiessession"].ToString().Length > 0 && Convert.ToString(Session["admincookiessession"]) == Convert.ToString(Request.Cookies["adminCookies"].Value))

                {

                    lb_user.Text = Session["adminsession"].ToString();

                }

                else

                {

                    //FormsAuthentication.SignOut();

                    //Request.Cookies.Remove("adminCookies");

                    //new Cookies().RemoveCookies("adminCookies");

                    //Response.Redirect("~/Login.aspx?message=" + "Invalid Session");


              //Cookies.ClearAllCookies();

                    FormsAuthentication.SignOut();

                    Request.Cookies.Remove("adminCookies");

                    new Cookies().RemoveCookies("adminCookies");

                    Session.RemoveAll();

                    Response.Redirect("~/Login.aspx");




                }


            }

            else

            {

              //  Cookies.ClearAllCookies();

                FormsAuthentication.SignOut();

                Request.Cookies.Remove("adminCookies");

                new Cookies().RemoveCookies("adminCookies");

                Session.RemoveAll();

                Response.Redirect("~/Login.aspx");


            }

        }

        catch (Exception ee)

        {

             Response.Redirect("~/Login.aspx?error=" + ee.Message.ToString(),false);

        }

    }

Data changing grid every second - data grid dynamic data - Mobile Android data changing web

 https://www.grapecity.com/wijmo/demos/Grid/CustomCells/DynamicUpdates/angular

Wednesday, September 21, 2022

Rrandom color changing background color webkit chrome

<style>
    body {background-color: yellow;} 
</style>-
---------------------
$(function() {
    if ($.browser.webkit) {
        $("body").css("background", "#4d4d4d");
    }
});
----------------------

<style type="text/css">
    body {
    -webkit-animation: colorchange 60s infinite; 
    animation: colorchange 20s infinite;
}
@-webkit-keyframes colorchange {
     0%  {background: #33FFF3;}
    25%  {background: #78281F;}
    50%  {background: #117A65;}
    75%  {background: #DC7633;}
    100% {background: #9B59B6;}
}
@keyframes colorchange {
     0%  {background: #33FFF3;}
    25%  {background: #78281F;}
    50%  {background: #117A65;}
    75%  {background: #DC7633;}
    100% {background: #9B59B6;}
}   
</style>

How to make website background red in web.config asp.net c#

 CSSFromWebConfig.aspx:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CSSFromWebConfig.aspx.cs" Inherits="ForForums.CSSFromWebConfig" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
        <style type="text/css">

		.primary-background-color
		{
			background-color: #126192;
		}
		.primary-font-color {
			color: <%= ConfigurationManager.AppSettings["customerColor"] %>;
		} 

</style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="primary-font-color">
    Test Color
    </div>
    </form>
</body>
</html>

 

CSSFromWebConfig.aspx.cs:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace ForForums
{
    public partial class CSSFromWebConfig : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

 

web.config:

  <appSettings>
    <add key="customerColor" value="#126192"/>
  </appSettings>
---------------------------------------------------------------------




If printer in not printing the page in windowns

> Click on window button

> Search for services.msc

>search for "print spooler"

> Stop and start the service and again print. It may work

references:- https://answers.microsoft.com/en-us/windows/forum/all/printer-says-error-processing-command-and-will-not/c82ab7a0-c2b1-4672-8dda-007e8cafa0c9

Tuesday, September 20, 2022

How to disable or enable menu in asp.net c# or hide or show menu or nav bar

 <div>

<ul class="nav navbar-nav" id="Menu_All" runat="server">


                        <%-- <li class="dropdown"><a id="A30" href="~/Default.aspx" runat="server"><img src="images/HomeIconn.png"  height="30px" width="30px" title="Click here goto Home Page" alt="homeImage" /></a></li>--%>


                       <%-- <li class="dropdown"><a id="A1" href="WelcomePMU.aspx" runat="server">Home</a></li>--%>

Sunday, September 18, 2022

Friday, September 16, 2022

Varchar size in GB in SQL

 2GB


also we can use sp_helpdb for size and other things of database

sp_helpdb databasename

Thursday, September 8, 2022

SQL select statement inside CASE statement

 select level_name=case when Course_level_id=5 then (case when 

((select Course_Entryon from MST_COURSE where course_id=454 ) >= '2022-04-01' ) then 'L5-L6'

when ((select Course_Entryon from MST_COURSE where course_id=454) = '')  then 'L5'

when ((select Course_Entryon from MST_COURSE where course_id=454) is NULL)  then 'L5'

else level_name end) else level_name end from dbo.MST_COURSE_LEVEL

where Course_level_id=(select distinct(Course_level_id) from MST_COURSE where course_id=454)

Function in Template field Grid view Label

  <asp:TemplateField HeaderText="Course Level" SortExpression="Course_id">

      <ItemTemplate>

      <asp:Label ID="lbl_crselevel" runat="server" Text='<%#GetLevelName(Eval("Course_id")) %>' ></asp:Label>

      </ItemTemplate>

      </asp:TemplateField>


aspx.cs page code

  public string GetLevelName(object CourseID)

    {

}

Wednesday, September 7, 2022

CASE Statement on Single column values SQL

 select LEVEL_ID, LEVEL_NAME =  CASE WHEN LEVEL_NAME ='L5' THEN 'L5/L6' 

ELSE LEVEL_NAME END, 

TOTAL_GRANT_SEAT, PERCENTAGE_OF_TOTAL_SEAT from tablename 


select LEVEL_ID, LEVEL_NAME = CASE WHEN LEVEL_NAME ='L5' THEN 'L5/L6' 

ELSE LEVEL_NAME END, 


or


select a.Course_id,'( ' +   case when(c.Course_level_id=5 and Course_Entryon >= '2022-04-01' ) 

then 'L5-L6' when(c.Course_level_id=5 and (Course_Entryon <= '2022-04-01' OR Course_Entryon IS NULL))

then 'L5' else c.level_name end + ') - ' + b.Course_name as Course_name

from TP_REQ_TO_CA_FOR_COURSE a join dbo.MST_COURSE b

on a.Course_ID=b.course_id join MST_COURSE_LEVEL c on

b.Course_level_id=c.Course_level_id and c.Course_level_status=1

where TP_ID='ESDM-HR-TP-000379' 


or


select level_name =case when Course_level_id = 5 then(case when

                   ((select Course_Entryon from MST_COURSE where course_id = @course_id ) >= '2022-04-01') then 'L5-L6'

                when((select Course_Entryon from MST_COURSE where course_id = @course_id) = '')  then 'L5'

                when((select Course_Entryon from MST_COURSE where course_id = @course_id) is NULL)  then 'L5'

                else level_name end) else level_name end from dbo.MST_COURSE_LEVEL

                where Course_level_id = (select distinct(Course_level_id) from MST_COURSE where course_id = @course_id)



or


SELECT CR.Max_course_fee, CR.course_id,CR.Course_Code,CR.Course_name,isnull(CR.Accreditation_fees,0) as Accreditation_fees,CL.Course_level_id,case when(CR.Course_level_id=5 and Course_Entryon >= '2022-04-01' ) 

then 'L5-L6' when(CR.Course_level_id=5 and (Course_Entryon <= '2022-04-01' OR Course_Entryon IS NULL))

then 'L5' else level_name end as level_name


,IV.Industry_vertical_id,IV.Industry_vertical_name,CA.Certifying_agency_id,CA.Certifying_agency_name,isnull(CA.Processing_fees,0) as Processing_fees,isnull(CA.Inspection_fees,0)as Inspection_fees  FROM dbo.MST_COURSE AS CR INNER JOIN dbo.MST_COURSE_LEVEL AS CL ON CR.Course_level_id = CL.Course_level_id INNER JOIN dbo.MST_INDUSTRY_VERTICAL AS IV ON CR.Industry_vertical_id=IV.Industry_vertical_id INNER JOIN dbo.MST_CERTIFYING_AGENCY AS CA ON CR.Certifying_agency_id=CA.Certifying_agency_id WHERE CR.Certifying_agency_id in(" + CertifyingAgencyID + ") AND CR.course_tp_status=1  AND CR.course_id NOT IN(SELECT Course_id FROM [dbo].[TP_REQ_TO_CA_FOR_COURSE]

CASE Statement on multiple columns values SQL in SELECT Query -SQL

 if you want to change two columns values



select *, PERCENTAGE_OF_LOCAL_SEAT = CASE 

WHEN LEVEL_NAME = 'L1-L2' THEN 0

WHEN LEVEL_NAME = 'L3' THEN 20 

WHEN LEVEL_NAME = 'L4' THEN 70 

WHEN LEVEL_NAME = 'L5' THEN 10

ELSE 0 END

from TableName



or with union all, all before and after union all columns number must be same

select LEVEL_ID, LEVEL_NAME, TOTAL_GRANT_SEAT, PERCENTAGE_OF_TOTAL_SEAT = CASE 

WHEN LEVEL_NAME = 'L1-L2' THEN 0

WHEN LEVEL_NAME = 'L3' THEN 20 

WHEN LEVEL_NAME = 'L4' THEN 70 

WHEN LEVEL_NAME = 'L5' THEN 0

WHEN LEVEL_NAME = 'L5/L6' THEN 10

ELSE 0 END, TOTAL_CALCULATED_SEAT, TOTAL_SEAT_LEFT, TOTAL_SEAT_ALLOTED, 

TOTAL_CALCULATED_SEAT_60, TOTAL_SEAT_LEFT_60, TOTAL_SEAT_ALLOTED_60,

TOTAL_CALCULATED_SEAT_40, TOTAL_SEAT_LEFT_40, TOTAL_SEAT_ALLOTED_40

from @temp

Union All

select  

0,

'Total',

SUM(ISNULL(TOTAL_GRANT_SEAT,0)),

SUM(ISNULL(PERCENTAGE_OF_TOTAL_SEAT,0)),

SUM(ISNULL(TOTAL_CALCULATED_SEAT,0)),

SUM(ISNULL(TOTAL_SEAT_LEFT,0)),

SUM(ISNULL(TOTAL_SEAT_ALLOTED,0)),

SUM(ISNULL(TOTAL_CALCULATED_SEAT_60,0)),

SUM(ISNULL(TOTAL_SEAT_LEFT_60,0)),

SUM(ISNULL(TOTAL_SEAT_ALLOTED_60,0)),

SUM(ISNULL(TOTAL_CALCULATED_SEAT_40,0)),

SUM(ISNULL(TOTAL_SEAT_LEFT_40,0)),

SUM(ISNULL(TOTAL_SEAT_ALLOTED_40,0))

from @temp

Tuesday, September 6, 2022

Try Catch Rollback commit SQL ASP.NET - Error handling in SQL - Error message from SQL to ASP.NET C# - Update Insert and Delete

 ALTER PROCEDURE [dbo].[USP_IUD_MST_STATEWISE_COURSE_LEVEL]

(

@Course_level_detail_id INT = NULL

,@Course_level_id  INT = NULL

,@state_id  INT = NULL

,@LevelPercentage  FLOAT = NULL

,@created_date DATE = NULL

,@type char(1)

)

AS

BEGIN

  BEGIN TRY 

     BEGIN TRAN

Friday, September 2, 2022

View convert varchar to datetime, if date is in varchar format in view -SQL

VARCHAR is not support greater than symbol and our datetime field is in varchar in view, so below is the solution:-

We have to convert VARCHAR into DATETIME format

SELECT 

  where 

                                Training_Partner_id='ESDM-HR-TP-000379' AND

                                Total_Certified > 0 AND Total_Placed>=( CASE WHEN ( CONVERT(DATETIME, Batch_Start_date,103) >='2022/04/01')

THEN

(CASE WHEN max_student_allowed % 2 = 0 

THEN ((max_student_allowed/2))

ELSE ((max_student_allowed/2)+1)

END )

ELSE

(0)

END)

Thursday, September 1, 2022

SQL Where with not in - where with in - where with more than one records

 select * from MST_BATCH 

where batch_code not in('BATCH-JH-14063', 'BATCH-JH-14474')

---------------

select yearof from MST_BATCH where yearof in ('2014-2015','2015-2016','2016-2017','2017-2018')

-------------------


select * from MST_BATCH 

where batch_code not in('BATCH-JH-14063', 'BATCH-JH-14474')



Exclude records from where condition SQL Server

select Batch_Code from MST_BATCH 

where batch_end_date <= '2020-03-24' and ScheduleExamDate is null and RequestStatus in(2, 0) and

not batch_code in('BATCH-JH-14063', 'BATCH-JH-14474', 'BATCH-HP-15572', 'BATCH-DL-15794', 

'BATCH-DL-15795', 'BATCH-WB-14501', 'BATCH-WB-14502', 'BATCH-RJ-15913','BATCH-AS-17031',

'BATCH-AS-17146', 'BATCH-CG-15425','BATCH-CG-16608', 'BATCH-CG-16601', 'BATCH-HR-17042',

'BATCH-HR-17144', 'BATCH-JH-15607', 'BATCH-MH-15325','BATCH-TS-14671','BATCH-TS-15247-DB',

'BATCH-BR-16142', 'BATCH-MP-15854', 'BATCH-MP-15855')

)

or

SELECT * FROM Geeks WHERE NOT GeekID > 104;

when condition with where clause SQL, CASE When under CASE When condition

 where Training_Partner_id='ESDM-HR-TP-000379' AND Total_Certified > 0

AND Total_Placed >=( CASE WHEN (Batch_Start_date ='01/04/2022')

THEN

                                 (CASE WHEN max_student_allowed % 2 = 0 

                            THEN ((max_student_allowed/2))

                                ELSE ((max_student_allowed/2)+1)

                            END )

ELSE

(0)

END)