Wednesday, July 19, 2023

Important Website Link API AND JQUERY

 http://csharpdotnetfreak.blogspot.com/2009/07/creating-crystal-reports-in-aspnet.html



https://www.aspsnippets.com/questions/171286/Open-Crystal-Reports-on-Button-Click-using-C-and-VBNet-in-Windows-Form/



https://www.aspsnippets.com/Articles/Print-Crystal-Report-on-Client-Side-on-Button-Click-using-JavaScript-in-ASPNet.aspx




https://www.kunal-chowdhury.com/p/download-visual-studio-2017.html

Product Key :-  KBJFW-NXHK6-W4WJM-CRMQB-G3CDH





https://meeraacademy.com/cookies-in-asp-net/


https://dotnettutorials.net/





API


https://www.javatpoint.com/web-api


https://www.c-sharpcorner.com/article/creating-web-api-project-on-visual-studio-2017/


https://www.tutorialspoint.com/asp.net_mvc/asp.net_mvc_web_api.htm#:~:text=ASP.NET%20Web%20API%20is,NET%20Framework.


https://www.javatpoint.com/web-api


https://www.c-sharpcorner.com/UploadFile/4d9083/how-to-create-web-api-in-Asp-Net-mvc/


https://dotnettutorials.net/lesson/creating-web-api-application/



https://www.tutorialspoint.com/asp.net_mvc/asp.net_mvc_web_api.htm




API  DATABASE 


https://www.tutorialsteacher.com/webapi/create-web-api-for-crud-operation


https://www.c-sharpcorner.com/article/web-api-crud-operations-and-consume-service-in-asp-net-mvc-application/


https://www.aspsnippets.com/Articles/Using-Web-API-with-Database-Tutorial-with-example-in-ASPNet-MVC.aspx








VALIDATION 2029 / 2027 / 2028 VERSION

 <appSettings>

    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />

  </appSettings>


Use inside tha config file 


Saturday, July 15, 2023

Client side validation

 

Client side  validation

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="valid1.aspx.cs" Inherits="valid1" %>

 

 

<html >

<head runat="server">

    <title></title>

 

     <script language="javascript" type="text/javascript">

         function validationCheck()

         {

             var summary = "";

             summary += isvaliduser();

             summary += isvalidpassword();

             summary += isvalidConfirmpassword();

             summary += isvalidFirstname();

             summary += isvalidLastname();

             summary += isvalidEmail();

             summary += isvalidphoneno();

             summary += isvalidLocation();

 

             if (summary != "")

             {

                 alert(summary);

                 return false;

             }

             else

             {

                 return true;

             }

 

         }

         function isvaliduser() {

             var id;

             var temp = document.getElementById("<%=txtuser.ClientID %>");

             id = temp.value;

             if (id == "") {

                 return ("Please Enter User Name" + "\n");

             }

             else {

                 return "";

             }

         }

         function isvalidpassword() {

             var id;

             var temp = document.getElementById("<%=txtpwd.ClientID %>");

             id = temp.value;

             if (id == "") {

                 return ("Please enter password" + "\n");

             }

             else {

                 return "";

             }

         }

         function isvalidConfirmpassword() {

             var uidpwd;

             var uidcnmpwd;

             var tempcnmpwd = document.getElementById("<%=txtcnmpwd.ClientID %>");

             uidcnmpwd = tempcnmpwd.value;

             var temppwd = document.getElementById("<%=txtpwd.ClientID %>");

             uidpwd = temppwd.value;

 

             if (uidcnmpwd == "" || uidcnmpwd != uidpwd) {

                 return ("Please re-enter password to confrim" + "\n");

             }

             else {

                 return "";

             }

         }

         function isvalidFirstname() {

             var id;

             var temp = document.getElementById("<%=txtfname.ClientID %>");

             id = temp.value;

             if (id == "") {

                 return ("Please enter first name" + "\n");

             }

             else {

                 return "";

             }

         }

         function isvalidLastname() {

             var id;

             var temp = document.getElementById("<%=txtlname.ClientID %>");

             id = temp.value;

             if (id == "") {

                 return ("Please enter last name" + "\n");

             }

             else {

                 return "";

             }

         }

         function isvalidEmail() {

             var id;

             var temp = document.getElementById("<%=txtEmail.ClientID %>");

             id = temp.value;

             var re = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

             if (id == "") {

                 return ("Please Enter Email" + "\n");

             }

             else if (re.test(id)) {

                 return "";

             }

 

             else {

                 return ("Email should be in the form ex:abc@xyz.com" + "\n");

             }

         }

         function isvalidphoneno() {

             var id;

             var temp = document.getElementById("<%=txtphone.ClientID %>");

             id = temp.value;

             var re;

             re = /^[0-9]+$/;

             var digits = /\d(10)/;

             if (id == "") {

                 return ("Please enter phone no" + "\n");

             }

             else if (re.test(id)) {

                 return "";

             }

 

             else {

                 return ("Phone no should be digits only" + "\n");

             }

         }

         function isvalidLocation() {

             var id;

             var temp = document.getElementById("<%=txtlocation.ClientID %>");

             id = temp.value;

             if (id == "") {

                 return ("Please enter Location" + "\n");

             }

             else {

                 return "";

             }

         }

</script>

 

</head>

<body>

    <form id="form1" runat="server">

 

 

    <table>

            <tr>

                <td>

                    Username</td>

                <td>

                    <asp:TextBox ID="txtuser" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    Password</td>

                <td>

                    <asp:TextBox ID="txtpwd" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    confirm password</td>

                <td>

                    <asp:TextBox ID="txtcnmpwd" runat="server"></asp:TextBox>

                </td>

            </tr>

 

            <tr>

                <td >

                    First name</td>

                <td>

                    <asp:TextBox ID="txtfname" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    last name</td>

                <td>

                    <asp:TextBox ID="txtlname" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    Emial Address</td>

                <td>

                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    Phone number</td>

                <td>

                    <asp:TextBox ID="txtphone" runat="server"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    Location</td>

                <td>

                    <asp:TextBox ID="txtlocation" runat="server" Height="22px"></asp:TextBox>

                </td>

            </tr>

            <tr>

                <td >

                    &nbsp;</td>

                <td>

                    <asp:Button ID="btnsubmit" runat="server" Text="Submit" />

                </td>

            </tr>

            <tr>

                <td >

                    &nbsp;</td>

                <td>

                    &nbsp;</td>

            </tr>

        </table>

 

    </form>

</body>

</html>

 

 

 

 

 

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

public partial class valid1 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

 

        btnsubmit.Attributes.Add("onclick", "javascript:return validationCheck()");

 

    }

}

select query using class and object

 Class  Code


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



using System.Data.SqlClient;


public class my

{

    SqlCommand cm;

    SqlConnection cn;

    SqlDataReader dr;


    public string city1;

    public string msg;

    

public string  display(string na)

    {


        string cs = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True";

        cn = new SqlConnection(cs);

        cn.Open();


        string k1 = "select * from demo where name=@name1";

        cm = new SqlCommand(k1, cn);

        cm.Parameters.AddWithValue("name1", na);

        dr = cm.ExecuteReader();

        if(dr.Read())

        {


            city1 = dr["city"].ToString();

            msg = "";

        }

        else

        {

            msg = "Record not found";

        }

        return k1;


    }

}







aspx page  code 


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;


public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {


    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        //Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True

        my m1 = new my();

        string data1 = m1.display(TextBox1.Text);

        TextBox2.Text = m1.city1;

        Label1.Text = m1.msg;


    }

}


Dropdown List Value concept


select colu,colu from table 



string k1 = "select Department_Name, Department_id from Department_mast";

        cm = new SqlCommand(k1, cn);

        dr = cm.ExecuteReader();

        ddldeptname.DataSource = dr;

        ddldeptname.DataTextField = "Department_Name";

        ddldeptname.DataValueField = "Department_id";

        ddldeptname.DataBind();

        ddldeptname.Items.Insert(0, "select");

        dr.Close();








Label1.Text = DropDownList1.SelectedItem.Value;


datatexfield

datavaluefield




dl.selecteditem.tex


d1.selecteditem.value 


Sunday, July 2, 2023

MVC jQuery

 https://www.aspsnippets.com/Articles/ASPNet-MVC-jQuery-AJAX-and-JSON-Example.aspx


https://stackoverflow.com/questions/37648811/how-to-use-jquery-in-mvc-asp-net-c-sharp


https://stackoverflow.com/questions/37648811/how-to-use-jquery-in-mvc-asp-net-c-sharp


Insert data record using jQuery lib


https://www.c-sharpcorner.com/UploadFile/0c1bb2/inserting-data-using-ajax/




https://www.aspsnippets.com/Articles/ASPNet-MVC-Insert-Data-to-Database-using-jQuery-AJAX.aspx


https://www.c-sharpcorner.com/blogs/how-to-insert-and-retrieve-data-using-jquery-ajax-in-asp-net


SQL Helper

 SQL helper class


https://nareshkamuni.blogspot.com/2011/11/sql-helper-class-in-aspnet.html?m=1


https://www.aspsnippets.com/Articles/Using-SqlHelper-class-in-ASPNet-Tutorial-with-examples-in-C-and-VBNet.aspx


https://www.codeproject.com/Tips/555870/SQL-Helper-Class-Microsoft-NET-Utility


http://www.blackbeltcoder.com/Articles/ado/an-ado-net-sql-helper-class

Summer Note EDITOR

 Step-1  <%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true...