Tuesday, 30 June 2015

ShortCut Keys(F1,F2...F12) Press (Keyboard) Open New Window Form in C# Window Application

Shortcut Key Press Open New Window Form 

Press ShortCut(Function Key) Like (F1,F2...F12) Open New Window Form or Existing Window Forms Using 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;

namespace WindowsFormsApplication2
{
    public partial class FunctionKey : Form
    {
        public FunctionKey()
        {
            InitializeComponent();
        }
        private void FunctionKey_Load(object sender, EventArgs e)
        {
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(KeyEvent);
        }
        private void KeyEvent(object sender, KeyEventArgs e) //Keyup Event 
        {
            if (e.KeyCode == Keys.F1)
            {
                Email ee = new Email();
                ee.Show();
            }
            if (e.KeyCode == Keys.F2)
            {
                Logee ll = new Logee();
                ll.Show();
            }
            if (e.KeyCode == Keys.F3)
            {
                Login li = new Login();
                li.Show();
            }
            else if (e.KeyCode == Keys.F4)
            {
                MessageBox.Show("This is Empty");
            }

        }
    }

}










Monday, 29 June 2015

Create ZipFile Insert Into Database During File Uploading Using in Asp.Net C#

Create ZipFile Insert Into Database During File Uploading

We Want To Create Zip File Whenever Uploading A New File Create ,Insert Zip File in Server Folder & Insert into Database Using in Asp.Net C#.

Multiple Zip Download
File Upload,Download
Download Single Zip File
Create Zip file

               Download Coding
                             Download
                                           ZIP.Dll

                       DEMO


                  HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Create ZipFile Insert Into Database During File Uploading Using in Asp.Net C#</title>   
</head>
<body>
    <form id="form1" runat="server">
    <div>        
    <table>
        <tr><td>
        <asp:FileUpload ID="FileUpload1" runat="server" />
            </td></tr>
        <tr><td>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Upload" />
            </td></tr>
    </table>
        <br />
        <br />
    </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.Data;
using System.Data.SqlClient;
using System.IO;
using Ionic.Zip;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {      
    }    
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new       SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());
        con.Open();
        string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
        string filelocate=(Server.MapPath("UploadFiles/" + filename)); // Upload Temporary
        FileUpload1.SaveAs(filelocate);
        ZipFile zip = new ZipFile();
        zip.AddFile(filelocate);   // Create Zip Temporay File
        string zipName = String.Format("Zip_{0}.zip"DateTime.Now.ToString("yyyy-MM-dd-HHmmss"));//Get Current Date
        zip.Save(Server.MapPath("ZipFiles/"+zipName));//Save Zip Folder Current Date & Time
        File.Delete(filelocate); //  After Delete Temporary File
        SqlCommand cmd = new SqlCommand
("insert into reg(filename,filepath)values('" + filename + "','" + "ZipFiles/" + zipName + "')", con);
        cmd.ExecuteNonQuery();
        Response.Write("<script>alert('Zip File Create & Uploaded')</script>");
       
    }
}


























    



    

Show Image Hover Effect Using CSS Style in Asp.Net

Show Image Hover Effect Using CSS Style 

Cursor Move To Display Image  Show Some Effects on MouseHover in Using CSS Style in Asp.Net.

                               Download Coding
                                                 Download

                                    DEMO


                        HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Show Image Hover Effect Using CSS Style in Asp.Net </title>
     <style>
        .ShowEffect:hover
        {
              box-shadow0 0 95px yellow;           
             width250px;
             height :250px;  
             -moz-box-shadow0 0 95px yellow;
              -webkit-box-shadow0 0 95px yellow;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div align="center">
            <br />
            <br />
<div class="ShowEffect" >  
         <asp:Image ID="Image1"  runat="server" ImageUrl="~/Koala.jpg" Height ="250px" Width="250px" />
    </div></div>
    </form>
</body>
</html>











Thursday, 25 June 2015

GridView Row Data in PopUp Using Button Click Event in Asp.Net C#

GridView Row Data in PopUp Using Button Click 

Display Database Records in  GridView Row Click Button Show Current GridView Row Details Popup Using in Asp.Net C#.

              Download Coding

                          Download

                               DEMO


                       HTML CODING



<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>GridView Row Data in PopUp Using Button Click Event in Asp.Net C#</title>   
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
    <br /><br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <AlternatingRowStyle BackColor="Silver" />
            <Columns>
                <asp:TemplateField HeaderText="View Popup">
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server"  Text="View Popup" OnClick="Button1_Click1" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="File Name">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("filename"%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="File Path">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("filepath"%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#CC3300" />
        </asp:GridView>
        <br />
    </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.Data;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         SqlConnection con = new
        SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from reg", con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        adp.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }  
    protected void Button1_Click1(object sender, EventArgs e)
    {
        Button  bt = (Button)sender;
        GridViewRow gr = (GridViewRow)bt.NamingContainer;
        string filename = (gr.FindControl("Label1"as Label).Text;
        string filepath = (gr.FindControl("Label2"as Label).Text;
     
        ClientScript.RegisterStartupScript
         (this.GetType(), "alert""alert('FileName=" + filename + "\\nFilePath=" + filepath + " ');"true);


    }

}