Show Popup Window on Page Load Using JQuery in Asp.Net C#

Show Popup  Window on Page Load


Open Website Show Popup Window  on Page _Load Function Without Button Click Event Using in JQuery Asp.Net C#.

                                              DEMO




HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<style type="text/css">

.popup{
width: 100%;
margin: 0 auto;
display: none;
position: fixed;
z-index: 101;
}
.bor{
min-width: 600px;
width: 600px;
min-height: 350px;
margin: 100px auto;
background: #808080;
position: relative;
z-index: 103;
padding: 10px;
border-radius: 5px;
}
.bor .clo{
float: right;
height: 35px;
left: 22px;
position: relative;
top: -25px;
width: 34px;
}
#drizz {
position: fixed;
width: 100%;
height: 100%;
background-color: #FF9933;
display: none;
}
</style>
<script type='text/javascript'>
    $(function () {
        var overlay = $('<div id="drizz"></div>');
        overlay.show();
        overlay.appendTo(document.body);
        $('.popup').show();
        $('.close').click(function () {
            $('.popup').hide();
            overlay.appendTo(document.body).remove();
            return false;
        });
        $('.clo').click(function () {
            $('.popup').hide();
            overlay.appendTo(document.body).remove();
            return false;
        });
       
    });
</script>
</head>
<body>
<div class='popup'>
<div class='bor'>
<img src='~/image/drop.gif' alt='quit' runat="server" class='clo' id='x' />
<h2 align="centre" >
dotnetdrizzles.blogsopt.in Asp.Net C# Tutorials<br />
    C#<br />
    DataBase connection<br />
    GridView Control<br />
    Calender Control<br />
    Image Control<br />
    Data Controls<br />
    JQuery <br />
    JavaScripts<br />
    SQL Server
    <br/>
<br/>
<a href="" class='close'>Hide</a>
</h2>
</div>
</div>
</body>
</html>


First - Add New Web Form - Add Html Coding For  PopUp  & JQuery  For Close





Next - Run[F5]  Show Popup PageLoad








Validation For DataGridview Values Before Insert To DataBase(Avoid Null Values) Using C# Window Application

Validation For DataGridview Values Before Insert To  DataBase

DataGridview Add Directly To RunTime  Validation Null Values Avoid To Insert  DataBase Using C# Window Applicatio.

                                         DEMO



                                    C# CODING

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication2
{
    public partial class Home11 : Form
    {
        public Home11()
        {
          
            InitializeComponent();
        }

        private void Home11_Load(object sender, EventArgs e)
        {
           
        }      

        private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
        {
            if ((dataGridView1[0, e.RowIndex].Value == null) || (dataGridView1[1, e.RowIndex].Value == null))
            {
                // e.Cancel = true;
                MessageBox.Show("Fill Empty Row");

            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count>1)
            {
                // Your Insert Command

                MessageBox.Show("Data Saved");
           
            }
        }
          
    }
}



Next - Add New Window Form - Select DataGridView - EditColumn - Add Field Name & Header Text





Next - Created DataGridView Column 







Next - DataGridview - Event - Select RowValidating Click 






Next - Add  DataGridView Validating Null Values 






Next - Run [F5]  The Program - Validation for DataGridView







Remove or Delete DataGridView Selected Row Button Click Using in C# Window application

Remove or Delete DataGridView Selected Row

DataGridview Selected Row Remove or Delete Button Click Event in C# Window Application.

                                         DEMO




     C# CODING


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication2
{
    public partial class Home11 : Form
    {
        public Home11()
        {
          
            InitializeComponent();
        }

        private void Home11_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Drizzles\Documents\Visual Studio 2012\WindowsFormsApplication2\WindowsFormsApplication2\Database1.mdf;Integrated Security=True");
            con.Open();

            SqlCommand cmd = new SqlCommand("select * from country", con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            adp.Fill(dt);
            SqlDataReader rd = cmd.ExecuteReader();
            if (rd.Read())
            {
                dataGridView1.DataSource = dt;
            }
          }

        private void button1_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count>1)
            {
                if (dataGridView1.Rows[dataGridView1.CurrentRow.Index].IsNewRow != true)
                {
                    dataGridView1.Rows.Remove(dataGridView1.CurrentRow);
                }
            }
            else {

                MessageBox.Show("No Record(s) Found");           
            }
        }      
    }
}



First - Add New Window Form - Select DataGridview From ToolBox







Next - DataGridview Bind Database Fields   & Button Click Event - Selected Row Delete Coding For DataGridView







Run[F5] - Remove Selected Row Values





The system cannot find the file specified - Error in C# Window Application

Error Reading Resource File - The system cannot find the file specified

The Error Occur in C# Window Application  Without Resource File (Deleted Form)  Display  - Delete Debug Folder From in Solution Explorer clear Error.


                              DEMO




Run[F5] The  Program - Show The Above Error  - Remove The Debug Folder From in Solution Explorer Folder.






Next - Run The Program Without Error


Get IPAddress and HostName From PC or Laptop Using in Asp.Net C#

Get IPAddress and HostName From PC or Laptop

Get the IPAddress and HostName From Pc Or Laptop Button Click in Asp.Net C#.

                                     DEMO



                         Download Coding

                               Download
                         

                             HTML COIDING


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <p>
    
            <asp:Label ID="Label1" runat="server" Text="IPAddress"></asp:Label>
<asp:TextBox ID="txtIPAddress" runat="server"></asp:TextBox>
  
            <asp:Label ID="Label2" runat="server" Text="HostName"></asp:Label>
<asp:TextBox ID="txtHostName" runat="server"></asp:TextBox>
   
         <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
    <div>
   
    </div>
    </form>
</body>
</html>


                               C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Net;
using System.Net.Sockets;
using System.IO;
public partial class IPGET : System.Web.UI.Page
{   
    protected void Button1_Click(object sender, EventArgs e)
    {
        GetComputer_LanIP();
    }
    protected string GetComputer_LanIP()
    {
        string HostName = System.Net.Dns.GetHostName();
        IPHostEntry ipEnt = System.Net.Dns.GetHostEntry(HostName);
        foreach (IPAddress ipAddress in ipEnt.AddressList)
        {
            if (ipAddress.AddressFamily.ToString() == "InterNetwork")
            {
                txtIPAddress.Text = ipAddress.ToString();
                txtHostName.Text = ipEnt.HostName.ToString();
                return ipAddress.ToString();
            }
        }

        return "-";
    }
}



First - Add New  - Form  - Select Label,Textbox,Button From ToolBox




Next - Add Namespaces - Network Call Ip Address for PC




Next - Run [F5] - Button Click - Show the Ip Address


Find Out PC & Laptop Power Status From in Battery Or Charging Using Asp.Net C#

Find Out PC & Laptop Power Status  in  Battery Or Charging 


Your PC or Laptop Charging From Battery or Charging in Asp.Net C#.

                                      DEMO
Charge Control Check

                       C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Management;
using System.Runtime.InteropServices;
using System.Windows.Forms;

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        PowerLineStatus status = SystemInformation.PowerStatus.PowerLineStatus;
        if (status == PowerLineStatus.Offline)
        {
            MessageBox.Show("Running on Battery");
        }
        else
        {
            MessageBox.Show("Running on Power");
        }
              
    }

}


First - Add New Web Form - Add Button From 

Toolbox





Next - Solution Explorer - Add - Add Reference 





Next - Add - System.Windows.Form - OK






Next - Add Namespaces - Add Charge Control  Status Checker






Next - Run[F5] - Click Button - Charge Control Check