Thursday, June 30, 2022

In Visual Studio intellisense is not comming intellisense not working in visual studio code

 >Open Visual Studio

>Right Click on Project in solution explorer

> Click on build

> Change the target framework to some other framework

How to maximize window in window 10 or shortcut key to maximize window

 Alt+Spacebar+x


or to restore Press Alt+Spacebar+r

Wednesday, June 29, 2022

How to make textbox multiline ASP.NET C# - with Bootstrap

 <asp:TextBox  ID="txtTPRemarks" runat="server" Multiline = "true" Text='<%#Eval("I_TP_REMARKS") %>' TextMode="MultiLine" />

Eval may be used with Grid Edit columns

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


<br />

                            <div class="row">

                                <div class="col-md-2">Remarks</div>

                                <div class="col-md-10">

                                    <asp:TextBox ID="txtPnlRemarks" TextMode="MultiLine" Rows="3" runat="server" CssClass="form-control"></asp:TextBox>

                                </div>

                            </div>

Gridview OnRowUpdating event get the value of label and textbox - ASP.NET

aspx page code
<asp:GridView ID="GridViewAdmin_Users" runat="server" DataKeyNames="OldPassword, OldSalt">

aspx.cs page code

 string orginial_password = GridViewAdmin_Users.DataKeys[e.RowIndex].Values[0];

string original_salt = GridViewAdmin_Users.DataKeys[e.RowIndex].Values[1];


 var tpRemarks = grd_Invoice.Rows[e.RowIndex].FindControl("txtTPRemarks") as TextBox;


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

reference:- https://stackoverflow.com/questions/43634813/get-old-value-of-label-inside-gridview-during-rowupdating-asp-net-gridview-c-s


CS0030: Cannot convert type 'string' to 'int' Visual Studio C# asp.net

 invoiceId = (int)(grd_Invoice.DataKeys[e.RowIndex].Value.ToString());


solution

invoiceId = int.parse(grd_Invoice.DataKeys[e.RowIndex].Value.ToString());


Tuesday, June 28, 2022

Gridview boundfield find by datafield name ASP.NET C# on grid rowupdaing event

 private int FindIndexByDataField(GridView gv, string datafieldname)

    {

        int index = -1, cnum = 0;

        foreach (DataControlField col in gv.Columns)

        {

            if (col is BoundField)

            {

                BoundField coll = (BoundField)gv.Columns[cnum];

                if (coll.DataField == datafieldname)

                {

                    index = cnum;

                    break;

                }

            }

            cnum++;

        }

        return index;

    }


protected void grd_Invoice_RowUpdating(object sender, GridViewUpdateEventArgs e)

    {

tpUpdateBy = grd_Invoice.Rows[e.RowIndex].Cells[FindIndexByDataField(grd_Invoice, "I_TP_UpdateBy")].Text;

}


reference :- https://stackoverflow.com/questions/35795278/how-to-get-boundfield-value-of-a-gridview-in-rowupdating-event

https://stackoverflow.com/questions/46489882/how-can-i-find-a-boundfield-inside-a-gridview-by-datafield

String Gridview array

 


Gridview.DataSource = new[] { new { Field1 = "1-1", Field2 = "1-2" }, new { Field1 = "2-1", Field2 = "2-2" } };

Gridview rowdatabound event in ASP.NET C# - grid row cell color

 protected void GridInvoiceRowDataBound(Object sender, GridViewRowEventArgs e)

    {

        if (e.Row.RowType == DataControlRowType.DataRow)

        {

            //if (Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "I_TP_Status")) == 1)

            //{

            if (Convert.ToInt16(DataBinder.Eval(e.Row.DataItem, "I_KIA_Statuss")) == 1)

            {

                //e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml("#D3D3D3");

                e.Row.Font.Bold = true;

                //e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml("#f7e405");

                e.Row.Cells[13].BackColor = System.Drawing.ColorTranslator.FromHtml("#f7e405");


            }

            else

Datefield ASP.NET C# GridView

 <asp:GridView ID="GridView1" runat = "server" AutoGenerateColumns="false">

    <Columns>
        <asp:BoundField DataField="Id" HeaderText="Customer Id" ItemStyle-Width="100px" />
        <asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="120px" />
        <asp:TemplateField HeaderText="Birth Date" ItemStyle-Width="120px" >
            <ItemTemplate>
                <asp:Label Text='<%# Eval("BirthDate", "{0:dd, MMM yyyy}") %>' runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

ASP.NET C# master page code page load event

 protected void Page_Init()

    {

        Browser.ClearBrowserData();

    }


  



    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);

     

How to stop visual studio from opening a file on single click?

 >Open Visual studio

>Click on Tools

>Click on Options>Environment>Tabs and windows

> Uncheck "preview tab"

> Click on OK

Monday, June 27, 2022

How to move one file from one folder to another folder in ASP.NET C#

 bool b = false;


        KIA obj = new KIA();

        string[] filePaths = Directory.GetFiles(MapPath("~/View/CertificationAgency/KIACertificate/Certificates/"));

        DirectoryInfo target = new DirectoryInfo(MapPath("~/View/CertificationAgency/KIACertificate/FinalCertificates/"));

        try

        {

            foreach (string s in filePaths)

            {

                if (Path.GetExtension(s).ToUpper().Equals(".PDF"))

                {

Friday, June 24, 2022

File Upload with handler ashx ASP.NET C#

 aspx file

<%@ Page Title="" Language="C#" MasterPageFile="~/View/CertificationAgency/CertificationAgency.master" AutoEventWireup="true" CodeFile="BulkUpload.aspx.cs" Inherits="View_CertificationAgency_KIACertificate_BulkUpload" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<style>

.fileuploadDiv{

 background-color:#E4F3F7;

 height:250px;

 width :80%;

 margin:0 auto;

 padding:15px;

 }

 .upload input{

 display: none;

}

List of District SQL Server Create Table

 CREATE TABLE [dbo].[MST_DISTRICT](

[District_Id] [int] NOT NULL,

[District_Name] [varchar](50) NULL,

[District_Code] [varchar](50) NULL,

[District_Status] [bit] NULL,

[State_id] [int] NULL,

 CONSTRAINT [PK_DISTRICT_MST] PRIMARY KEY CLUSTERED 

(

[District_Id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO


ALTER TABLE [dbo].[MST_DISTRICT] ADD  CONSTRAINT [DF_DISTRICT_MST_District_Status]  DEFAULT ((1)) FOR [District_Status]

GO


ALTER TABLE [dbo].[MST_DISTRICT]  WITH CHECK ADD  CONSTRAINT [FK_MST_DISTRICT_MST_STATE] FOREIGN KEY([State_id])

REFERENCES [dbo].[MST_STATE] ([State_id])

GO


ALTER TABLE [dbo].[MST_DISTRICT] CHECK CONSTRAINT [FK_MST_DISTRICT_MST_STATE]

GO



List of banks Database Table SQL

CREATE TABLE [dbo].[MST_BANK](

[Bank_id] [int] NOT NULL,

[Bank_name] [varchar](100) NULL,

[Bank_status] [bit] NULL,

 CONSTRAINT [PK_BANK_MST] PRIMARY KEY CLUSTERED 

(

[Bank_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],

 CONSTRAINT [IX_MST_BANK] UNIQUE NONCLUSTERED 

(

[Bank_name] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

Thursday, June 23, 2022

How to create multiple folder in command prompt

Open command prompt

 md 1 2 3 4 5 6 7 8 9 10

How to create 100 files in command prompt

Open command prompt

Create 100 files

 for /l %a in (1 1 100) do type nul > "MyDoc-%a.txt"


Create 1000 files

 for /l %a in (1 1 1000) do type nul > "MyDoc-%a.txt"


Create 10000 files

 for /l %a in (1 1 10000) do type nul > "MyDoc-%a.txt"

How to create large file of 50 mb or 2 gb or 48 g file

Open command prompt

write this below command

 fsutil file createnew test.txt 52428800 to create 50 mb file


fsutil file createnew test3.txt 5000000000 to create 4 gb file


fsutil file createnew test3.txt 50000000000 to create 4 gb file


or

Create a 100MB file with real data:

echo "This is just a sample line appended  to create a big file. " > dummy.txt
for /L %i in (1,1,21) do type dummy.txt >> dummy.txt
echo "This is just a sample line appended  to create a big file. " > dummy.txt
for /L %i in (1,1,21) do type dummy.txt >> dummy.txt
The above command creates a 128 MB file

How to record screen in window 10

 Enter key window key + Alt + G

Click on start recording

 Enter key window key + Alt + G to stop recording

It will be save into My computer>Videos>Captures

or

>Go to Control panel

>Click on Gaming


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


> Click on Start button

> Click on steps recorder or voice recorder


Auto power on or off in android phone or mobile

 > Go to settings

> Go to more settings

> Click on schedule power on or off

> Click on repeat every day

> Also give the power on or off time

How to auto power on or off computer in windows 10

Click on start button> search for task scheduler> In this we can create task

 https://www.isunshare.com/windows-10/how-to-set-windows-10-computer-to-auto-start-on-a-schedule.html

What is taskbar and how to hide or show taskbar and how to move up top down left the taskbar and to small the icons of taskbar

Taskbar is on bottom of desktop where you click on start menu and icons are show.


>Go to control panel

> Click on Taskbar and navigation.

> Click on use small taskbar icons to small the icon buttons of taskbar

> Click on combine taskbar button dropdown to show taskbar buttons text

Textbox with Uppercase and remove some characters in C# ASP.NET

 <asp:TextBox ID="txt_regid" runat="server" Style="text-transform: uppercase;" Width="250px"

                        CssClass="form-control" placeholder="Enter Student Reg. ID">

                    </asp:TextBox>

                    <cc1:FilteredTextBoxExtender ID="filterRegid" TargetControlID="txt_regid" FilterMode="InvalidChars"

                        InvalidChars="!@#$%^&*()+=<>{}[]|\?/.,';:" runat="server">

                    </cc1:FilteredTextBoxExtender>

Wednesday, June 22, 2022

How to download PDF File to zip folder on button click in C# ASP.NET

  public DataTable GetCertificate(string batchid)

    {

        object ob = null;

        try

        {

            string Q = @"select certificatepath,Studentregid from Mst_Student_Certificate where BATCH_CODE=@Batch_id";

            SqlParameter[] para = { new SqlParameter("@Batch_id", batchid) };

           DataTable dt = Luminious.DataAcessLayer.SqlHelper.ExecuteDataTable(Luminious.Connection.Configuration.ConnectionString, CommandType.Text, Q, para);

           if (dt != null && dt.Rows.Count > 0)

           {

               using (ZipFile zip = new ZipFile())

               {

How to download JPG or JPEG to zip file on button click C# ASP.NET

 protected void DownloadPhoto(object sender, EventArgs e)

    {

        List<string> refil = new List<string>();


        try

        {


            using (ZipFile zip = new ZipFile())

            {


                zip.AddDirectoryByName("Files");

                foreach (GridViewRow row in grdStudentList.Rows)

                {

                    string filePath = (row.FindControl("img_photo") as Image).ImageUrl;

                    Label lblRegd = (Label)row.FindControl("lbl_studregid");

                    string filePath1 = Server.MapPath(filePath);


                    string sourcepath = filePath;

SQL ISNULL Function

 SELECT ISNULL(NULL, 50)


If first param is null than return 50


 SELECT ISNULL(30, 50)

If first param not null than return 50

Grid view Row Download button PDF File ASP.NET C#

 protected void grd_certificate_RowCommand(object sender, GridViewCommandEventArgs e)

    {

        if (e.CommandName.Equals("down") && e.CommandName !=null)

        {

            try

            {

                string fpath = e.CommandArgument != null ? "~/View/CertificationAgency/KIACertificate/FinalCertificates/" + Convert.ToString(e.CommandArgument) : null;

                if (fpath != "")

                {

                    if (fpath != "")

                    {

                        string path = MapPath(fpath);

                        byte[] bts = System.IO.File.ReadAllBytes(path);

                        Response.Clear();

Try and Catch with WriteException for log and other exception for alert in C# ASP.NET

try

{

}

catch (FileNotFoundException ex)

            {

                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Nothing to download');", true);

            }

            catch (IOException ex)

            {

                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Nothing to download');", true);

            }

            catch (Exception ex)

            {

                ExceptionHandler.WriteException(ex.Message);

            }

How to get IP address in C# ASP.NET

 public string IPAddr()

    {

        try

        {



            string ipaddress;


            ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];


            if (ipaddress == "" || ipaddress == null)


                ipaddress = Request.ServerVariables["REMOTE_ADDR"];


            return ipaddress;


        }

        catch (Exception ex)

        {

            ExceptionHandler.WriteException(ex.Message);

        }

        return null;

    }

Grid View Paging with small Stored Procedure C# ASP.NET with pager DataList

 Stored Procedure

CREATE PROCEDURE [dbo].[GetCertificate_Admin]

      @StartIndex int,

      @PageSize int,

  @kiaid int,

      @TotalCount int OutPut

as

select @TotalCount=count(1) from vw_Student_certificate ;

WITH CTE AS

(

   select top(@startIndex+@PageSize-1) ROW_NUMBER() OVER(ORDER BY id ) RowNumber,Student_registration_id,Name,TP_Name,certificatepath,level_name,Course_Code,Course_name,Father_Name,Mother_Name,Gender,Adharcard_No,Catagory_name

   from vw_Student_certificate 

)

select * from CTE where RowNumber between @startIndex and (@startIndex+@PageSize-1)

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

SQL Profiler in SQL Server

 In SQL Server Management Studio

> Click on Tools and Click on SQL Profiler

Monday, June 20, 2022

How to create backup of database in C# ASP.NET 2 another way

 Stored procedure


USE [ESDM_NIELIT_NEW]

GO

/****** Object:  StoredProcedure [dbo].[USP_DB_BACKUP1]    Script Date: 20-06-2022 16:03:46 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO


ALTER proc [dbo].[USP_DB_BACKUP1]

as

begin

How to create backup of database in C# ASP.NET

 Create table

USE [ESDM_NIELIT_NEW]

GO


/****** Object:  Table [dbo].[MST_DB_BACKUP]    Script Date: 20-06-2022 15:40:03 ******/

SET ANSI_NULLS ON

GO


SET QUOTED_IDENTIFIER ON

GO


CREATE TABLE [dbo].[MST_DB_BACKUP](

[BAK_ID] [int] IDENTITY(1,1) NOT NULL,

[BACKUP_NM] [varchar](300) NULL,

[BACKUP_DT] [datetime] NULL,

[BACKUP_PATH] [varchar](300) NULL,

 CONSTRAINT [PK_MST_DB_BACKUP] PRIMARY KEY CLUSTERED 

(

[BAK_ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO



Billdesk payment gateway in C# ASP.NET

 WEB.CONFIG FILE

<add key="MerchantId" value=" MYSITE "/>

<add key="CurrencyType" value="INR"/>

<add key="TypeField1" value="R"/>

<add key="SecurityId" value="mysite"/>

<add key="TypeField2" value="F"/>

<add key="AdditionlaInfo1" value="NA"/>

<add key="AdditionlaInfo2" value="NA"/>

<add key="ReturnUrl" value="http://www.mysite.com/ReturnFromBillDesk.aspx"/>

<add key="BillDeskUrl" value="https://www.billdesk.com/pgidsk/PaymentEntry.jsp"/>

<add key="CheckSumKey" value="9FGcERMK1GfF"/>



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

<form name=’abc’ method='POST'  

action='https://www.billdesk.com/pgidsk/pgijsp/MerchantPaymentoption.jsp'>

  <input type='hidden' name='txtCustomerID' value='1073234'>

  <input type='hidden' name='txtTxnAmount' value='2400.30'>

  <input type='hidden' name=' txtAdditionalInfo1' value='  

    Identity of Merchant website with Billdesk '>

  <input type='hidden' name=' txtAdditionalInfo2' 

    value='USD'>

  <input type='hidden' name=' txtAdditionalInfo3'      

    value='Kerala Backwaters'>

  <input type='hidden' name=' txtAdditionalInfo4' value='25-

    Sep-08'>

  <input type='hidden' name=' txtAdditionalInfo5' value='28-

    Sep-08'>

  <input type='hidden' name=' txtAdditionalInfo6' value='2'>

  <input type='hidden' name=' txtAdditionalInfo7' value='1'>

  <input type='hidden' name='RU' 


    value='https://payment.merchant.com'>


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


<html>

<head id="Head1" runat="server">

    <title>Paymenttitle>

<script type="text/javascript">

    function myfunc ()

    {

    var frm = document.all("form2");

    frm.submit();

    }

    window.onload = myfunc;

script>

head>

<body>

    <form id="form2" method="post" action="https://www.billdesk.com/ Paymentoption.jsp" name="form2">

        <input type="hidden" name="txtCustomerID" 

               value="<%=Request("txtCustomerID")%>" />

        <input type="hidden" name="txtTxnAmount" 

               value="<%=Request("txtTxnAmount")%>" />

             <input type="hidden" name="txtAdditionalInfo1" 

                    value="<%=Request("txtAdditionalInfo1")%>" />


        <input type="hidden" name="txtAdditionalInfo2" 


               value="<%=Request("txtAdditionalInfo2")%>" />

        <input type="hidden" name="txtAdditionalInfo3" 

               value="<%=Request("txtAdditionalInfo3")%>" />

        <input type="hidden" name="txtAdditionalInfo4"                

               value="<%=Request("txtAdditionalInfo4")%>" />

        <input type="hidden" name="txtAdditionalInfo5" 

               value="<%=Request("txtAdditionalInfo5")%>" />

        <input type="hidden" name="txtAdditionalInfo6" 

               value="<%=Request("txtAdditionalInfo6")%>" />

        <input type="hidden" name="txtAdditionalInfo7" 

               value="<%=Request("txtAdditionalInfo7")%>" />

        <input type="hidden" name="RU"          value="http://www.mahindrahomestays.com/Pages/confirmation.aspx" />

     form>

body>

     html> 


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


string _paymentResp = Request.Form["msg"];                      

string[] arrResponse = _paymentResp.Split('|'); //PG

     string merchantId = arrResponse[0];

     string _customerId = arrResponse[1];

     string txnReferenceNo = arrResponse[2];

     string bankReferenceNo = arrResponse[3];

     string txnAmount = Convert.ToDecimal(arrResponse[4]);

     string bankId = arrResponse[5];

     string bankMerchantId = arrResponse[6];

     string txnType = arrResponse[7];

     string currency = arrResponse[8];

     string itemCode = arrResponse[9];

     string securityType = arrResponse[10];

     string securityId = arrResponse[11];

     string securityPassword = arrResponse[12];

     string txnDate = arrResponse[13]; //dd-mm-yyyy

     string authStatus = arrResponse[14];

     string settlementType = arrResponse[15];

     string additionalInfo1 = arrResponse[16];

     string additionalInfo2 = arrResponse[17];

     string additionalInfo3 = arrResponse[18];

     string additionalInfo4 = arrResponse[19];

     string additionalInfo5 = arrResponse[20];

     string additionalInfo6 = arrResponse[21];

     string additionalInfo7 = arrResponse[22];

     string errorStatus = arrResponse[23];

     string _errorDescription = arrResponse[24]


references:- http://techgeek14.blogspot.com/2012/03/billdesk-payment-gateway-integration.html


https://www.dotnetfunda.com/articles/show/1341/bill-desk-payment

How to convert dataset to JSON with webservice ASP.NET C# using Luminious.DataAcessLayer.SqlHelper.ExecuteDataset

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Services;

using System.Data;

using System.Collections;

using System.Web.Script.Serialization;

/// <summary>

/// Summary description for MIETY_SkillDevelopment

/// </summary>

[WebService(Namespace = "/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 

 [System.Web.Script.Services.ScriptService]

public class MIETY_SkillDevelopment : System.Web.Services.WebService {


    String frmName = "Miety Skill Development";

    public MIETY_SkillDevelopment () {

How to create random hashing in ASP.NET C#

 private void CreateRandomHashing()

        {

            Random rd = new Random();

            Session["rnumb"] = rd.Next();

            rno = Convert.ToString(Session["rnumb"]);


            btnResetPwd.Attributes.Add("onClick", "return chkfrm('" + rno + "');");

            

        }


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

aspx page code

function chkfrm() {

debugger;

Sending Mail in ASP.NET C#

 public bool SendLink(string UserType, string UserID, string EmailID)

    {

        bool tran = false;

        try

        {

            string ResetCode = Guid.NewGuid().ToString();

            int TranRes = 0;


            System.Text.StringBuilder sbBody = new System.Text.StringBuilder();

            sbBody.Append("Your Registration Id is : <b>" + UserID + "</b>&nbsp;&nbsp;");

SQL Server date with Convert function

 select Convert(date,CURRENT_TIMESTAMP,103)

Declare variable inside begin Stored Procedure SQL Server

 declare @Original_Stu_count int

declare @Max_Stu_Count int

SQL Server configuration manager missing in windows

 If you type SQL Server configuration manager in window search button and it is not showing 

> Right Click on My computer

> Click on Manage

> Click on services and applications

> Click on SQL Server Configuration Manager

>Click on SQL Server Network Configuration

> Click on protocols of SQLexpress

>Right Click on TCP/IP

> Click on properties

> Click on IP Addresses Tab

>In Last IPALL, Enter TCP port 1433

Mapping of Tomcat with Java 8

 > If you have installed java runtime 8 separately from tomcat server

> Press window button and write configure tomcat 

> Click on configure tomcat and Click on Java tab

> Change the path of dll file, that you have installed latest

(screen


shot below)



Friday, June 17, 2022

Multiple data field in single Column Grid View ASP.NET C#

  <asp:TemplateField HeaderText="Exam Date Details" ItemStyle-Width="100">

                            <ItemTemplate>

                                <asp:Label ID="Scheduled_Exam_Date" runat="server" Text='<%# "<b>First:</b> " + "" + Eval("Scheduled_Exam_Date") %>' />

                                <br />

                                <asp:Label ID="SecondTimeAppearScheduledDate" runat="server" Text='<%# "<b>Second:</b> " + "" + Eval("SecondTimeAppearScheduledDate") %>' />

                                <br />

                                <asp:Label ID="ThirdTimeAppearScheduledDate" runat="server" Text='<%# "<b>Third:</b> " + "" + Eval("ThirdTimeAppearScheduledDate") %>' />

                            </ItemTemplate>

                            <ItemStyle Width="100" />

                        </asp:TemplateField>

JQuery tabs C# ASP.NET

 <style type="text/css">


        .nav-tabs > li > a.tab1,.nav-tabs > li.active > a.tab1, .nav-tabs > li.active > a.tab1:hover, .nav-tabs > li.active > a.tab1:focus {

    color: #fff;

    cursor: pointer;

    background-color: #4aad44;

    border: 1px solid #ddd;

    border-bottom-color: transparent;

    border-top-right-radius:10px;

    border-top-left-radius:10px;

}


        .nav-tabs > li> a.tab2,.nav-tabs > li.active > a.tab2, .nav-tabs > li.active > a.tab2:hover, .nav-tabs > li.active > a.tab2:focus {

    color: #fff;

Refresh and Auto redirect to some other page on button click event

protected void btn_update_Click(object sender, EventArgs e)

{

 HtmlMeta meta = new HtmlMeta();


                                                    meta.HttpEquiv = "Refresh";


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


                                                    this.Page.Controls.Add(meta);

}

Thursday, June 16, 2022

Textbox with calendar in ASP.NET C#

 <td>  Date of Birth <span style="color:Red;">*</span></td>

            <td>

                <asp:TextBox ID="txt_dob" runat="server" CssClass="form-control"  required="" x-moz-errormessage="Enter Date of Birth"

                    placeholder="Date of Birth"></asp:TextBox>

                <cc1:CalendarExtender ID="txt_calender" runat="server" Format="dd/MM/yyyy" TargetControlID="txt_dob">

                </cc1:CalendarExtender>

                <asp:CompareValidator ID="cfvDOB" ForeColor="Red" ControlToValidate="txt_dob" Type="Date" Operator="LessThan"

                            ErrorMessage="(Age can't be less than 15 years)" Display="Dynamic"  ValidationGroup="Save2"

                            runat="server"></asp:CompareValidator>

                            <asp:RequiredFieldValidator ID="reqval" runat="server" ValidationGroup="Save2" ErrorMessage="Enter Date of Birth" ForeColor="Red" ControlToValidate="txt_dob">

                            </asp:RequiredFieldValidator>



            </td>

How to execute stored procedure with output parameter

Right Click on stored procedure and click on execute stored procedure

or

 DECLARE @return_value int,

@RecordCount int


EXEC @return_value = [dbo].[GetCustomersPageWiseNew]

@batchCode = N'batch-hr-00002-db',

@PageIndex = 1,

@PageSize = 10,

@RecordCount = @RecordCount OUTPUT


SELECT @RecordCount as N'@RecordCount'


SELECT 'Return Value' = @return_value


GO


reference:- https://stackoverflow.com/questions/1589466/execute-stored-procedure-with-an-output-parameter

Wait delay in SQL query

 waitfor delay '00:00:00:01';delete from Student_Registraion_Temp_New where id=@id

How to show text in textbox and uploaded photo in image and radio button and drop down from database in ASP.NET C#

 txt_ifsc.Text = dt.Rows[0]["Ifsc_Code"] == DBNull.Value ? string.Empty : Convert.ToString(dt.Rows[0]["Ifsc_Code"]);


if( dt.Rows[0]["stuphoto"]!=DBNull.Value)

                    {

                    imgPhoto.ImageUrl = dt.Rows[0]["stuphoto"] == DBNull.Value ? "dummy.png" : "~/View/TrainingPartner/StudentData/Photo/" + Convert.ToString(dt.Rows[0]["stuphoto"]);

                    ReqImagePhoto.Enabled = false;

                    }

                    else

                    {

                        ReqImagePhoto.Enabled = true;

                    }

string Bankname = dt.Rows[0]["Bank_Name"] == DBNull.Value ? string.Empty : Convert.ToString(dt.Rows[0]["Bank_Name"]);

                    drp_bankName.ClearSelection();

                    if (drp_bankName.Items.Contains(new ListItem(Bankname)))

                    {

                        drp_bankName.Items.FindByText(Bankname).Selected = true;

                    }


if (dt.Rows[0]["Marital_Status"] != DBNull.Value )

                        {

                            string mstatus = dt.Rows[0]["Marital_Status"] == DBNull.Value ? string.Empty : Convert.ToString(dt.Rows[0]["Marital_Status"]);

                            if (mstatus.Equals("Single") || mstatus.Equals("Married") || mstatus.Equals("Divorced") || mstatus.Equals("Widowed"))

                            {

                                rbtn_martialstatus.ClearSelection();

                                rbtn_martialstatus.Items.FindByText(mstatus).Selected = true;

                            }

                        }

                        else

                        {

                            rbtn_martialstatus.ClearSelection();

                        }


---------------------ASPX.CS Page Load

        cfvDOB.ValueToCompare = DateTime.Now.AddYears(-15).ToString("d");

        txt_dob.Attributes.Add("readonly", "readonly");

SELECT QUERY with Exist or Not Exist

 IF NOT EXISTS(select batch_code from TBL_BATCH_EXTEND where batch_code='BATCH-HR-00005-DB')

print 'true'

else

print 'false'

backstretch.js and slider.js for sliding in website

<script src="jquery.backstretch.js"></script>

<script type='text/javascript' src='Slider.js'></script> 

 <script>

      $.backstretch([

          "3.jpg",

          "PLI_Industry_dixon.jpg",

          "PLI_Industry.jpg",

          "side.jpg",

  "people.jpg"

        ], {

            fade: 750,

            duration: 5000

        });

    </script>


Website Default.aspx popup image C# ASP.NET with Jquery

 <%--Add Popup New JS on 30092021--%>

    <script type="text/javascript" src="slider.js"></script>

    <script type='text/javascript'>

        $(function () {

            var overlay = $('<div id="overlay"></div>');

            overlay.show();

            overlay.appendTo(document.body);

            $('.popup').show();

            $('.close').click(function () {

Stored Procedure with rollback in SQL Server - Exceptional handling - Try Catch

 CREATE procedure [dbo].[pro_batchExtendUpdate2](@dey int)

as

begin

begin try

begin tran

truncate table TBL_BATCH_EXTEND

insert into TBL_BATCH_EXTEND

 select Batch_Code,getdate(),@dey from MST_BATCH 


 commit tran


 end try


 begin catch

 rollback tran

 select ERROR_MESSAGE()

 end catch


 end



What is the difference between Truncate and Delete Command in SQL

 Truncate is used to delete all the records from the table and we cannot rollback.

By delete we can rollback and we can delete one or more rows.


reference:- https://unstop.com/blog/difference-between-delete-and-truncate-in-sql


Wednesday, June 15, 2022

How to add HTML/Javascript to blogger

 >Click on menu

> Click on layout

> Click on Add a gadget and select HTML/Javascript

How to change font of posts in blogger

 > Go to settings

> Go to themes

> Click on customize

> Click on Advanced and change page text

How to create Favicon in blogger

 >Click on left side menu

> Click on settings

> Click on Favicon and upload icon you want to use.

How to add read more button on blog posts

Insert Jump break in the post


reference:- https://support.pipdig.co/articles/blogger-how-to-add-a-read-more-button-to-posts/

How to use ExecuteNonQuery with SQLHelper class

protected void btn_Click(object sender, EventArgs e)
    {
lblMsg.Text = "";
        int result = 0;
        string UserProc = "PR_MST_TBL_STUD_PAYMENT_REFUND_Insert";
        try
        {
            DateTime paydt=DateTime.ParseExact(txtDate.Text!=""?txtDate.Text:DateTime.Now.ToString("dd/MM/yyyy"),"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture);

Datetime parsing C# ASP.NET current date today date

  DateTime paydt=DateTime.ParseExact(txtDate.Text!=""?txtDate.Text:DateTime.Now.ToString("dd/MM/yyyy"),"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture);

Some icons and images used in websites

 https://drive.google.com/drive/folders/1wP-9fS2bpl9OSGidq2AhTMt56Gdq6V1f?usp=sharing

How to find view is present or exist in database or not in SQL Server

 if exists( SELECT name FROM esdm_nielit_new.sys.views WHERE name = 'VW_STUDENT_REGD_NEW')

DROP VIEW [dbo].[VW_STUDENT_REGD_NEW]

else 

begin

print 'view VW_STUDENT_REGD_NEW not found'

end

How to get Machine Address with C# ASP.NET

 public string MachineAddress()

    {

        NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();

        //display the physical address of the first nic in the array,

        //which should correspond to our mac address

        return (nics[0].GetPhysicalAddress().ToString());


    }

Monday, June 13, 2022

PopUp Panel in ASP.NET C#

.PopUpPanel {  

  position:absolute;

  background-color: #ccc;   

  top:250px;

  left:0;

  right:0;

  margin:0 auto;

  z-index:2001; 

  padding:5px;

  width:1200px;

  -moz-box-shadow:3.5px 4px 5px #000000;

  -webkit-box-shadow:3.5px 4px 5px #000000;

Simple static download of excel file in C# ASP.NET

 <label>Process for Bulkupload &nbsp;</label>

<a href="../../../Student Registration – Bulk Data Upload Process_Final.docx" class="label label-default">Click Here</a>


<label>Download Excel File &nbsp;</label>

<a  href="../../../Template for Bulk Upload V2.xlsx" class="label label-danger">Click Here</a>

Export to excel of Grid with Heading C# ASP.NET

 void ExportToExcel(DataTable dt, string FileName)

    {

        if (dt.Rows.Count > 0)

        {

            string filename = FileName + ".xls";

            System.IO.StringWriter tw = new System.IO.StringWriter();

            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);

            tw.Write("<div align='left'>");

            tw.Write("<h1>");

            tw.WriteLine("List of Registered Student");

            tw.Write("</div>");

            tw.Write("</h1>");

How to check whether a aadhar card is valid or not in C# ASP.NET

 public static class VerhoeffAlgorithm




{


    // The multiplication table

    static int[,] d = new int[,]

        {

            {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 

            {1, 2, 3, 4, 0, 6, 7, 8, 9, 5}, 

            {2, 3, 4, 0, 1, 7, 8, 9, 5, 6}, 

            {3, 4, 0, 1, 2, 8, 9, 5, 6, 7}, 

            {4, 0, 1, 2, 3, 9, 5, 6, 7, 8}, 

            {5, 9, 8, 7, 6, 0, 4, 3, 2, 1}, 

            {6, 5, 9, 8, 7, 1, 0, 4, 3, 2}, 

            {7, 6, 5, 9, 8, 2, 1, 0, 4, 3}, 

            {8, 7, 6, 5, 9, 3, 2, 1, 0, 4}, 

            {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}

        };

How to enable or disable navigation bar in android phone

 > Click on settings

> Click on more settings

> Scroll down and Click on Navigation bar

How to disable visual effects or animation in android phone

 > Go to Settings

> Go to More settings

> Go to Accessibility

> Click on Remove animation and Disable it