Tuesday, 3 May 2016

Implement check all checkbox functionality in ASP.Net GridView control using JavaScript

Implement check all checkbox functionality in ASP.Net GridView control using JavaScript

database Structure of tbl_login 





















First add below script between <head> tag

<script type="text/javascript" language="javascript">
        function CheckAllEmp(Checkbox) {
            var GridVwHeaderChckbox = document.getElementById("<%=grdata.ClientID %>");
            for (i = 1; i < GridVwHeaderChckbox.rows.length; i++) {
                GridVwHeaderChckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
            }
        }
    </script> 

Note: where grdata is gridview id.

Now add gridview in your aspx page

<asp:GridView runat="server" ID="grdata" AutoGenerateColumns="false" DataKeyNames="UserName" class="table table-striped table-bordered table-hover">
 <Columns>
    <asp:TemplateField>
        <HeaderTemplate>
              <asp:CheckBox ID="chkHeader" runat="server" onclick="CheckAllEmp(this);" />
        </HeaderTemplate>
     <ItemTemplate>
        <asp:CheckBox runat="server" ID="chck" />
      </ItemTemplate>
  </asp:TemplateField>
   <asp:TemplateField HeaderText="Name">
        <ItemTemplate>
           <asp:Label runat="server" ID="lblName" Text='<%#Eval("Name") %>'></asp:Label>
         </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Mobile">
     <ItemTemplate>
       <asp:Label runat="server" ID="lblMobile" Text='<%#Eval("Mobile") %>'></asp:Label>
       </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField HeaderText="ID">
       <ItemTemplate>
         <asp:Label runat="server" ID="lblid" Text='<%#Eval("UserName") %>'></asp:Label>
       </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField HeaderText="Address">
       <ItemTemplate>
      <asp:Label runat="server" ID="lblAddress" Text='<%#Eval("Address") %>'></asp:Label>
    </ItemTemplate>
   </asp:TemplateField>
  <asp:TemplateField HeaderText="Email">
    <ItemTemplate>
       <asp:Label runat="server" ID="lblEmail" Text='<%#Eval("emailid") %>'></asp:Label>
     </ItemTemplate>
 </asp:TemplateField>
</Columns>

</asp:GridView>

In .CS FILE add this code for bind gridview 


void bind()
    {
        try
        {
            Connection.con.Open();
            SqlCommand cmd = new SqlCommand("select * from tbl_Login where Role ='Sr Coordinator' order by id desc", Connection.con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                grdata.DataSource = dt;
                grdata.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                grdata.DataSource = dt;
                grdata.DataBind();
                int count = grdata.Rows[0].Cells.Count;
                grdata.Rows[0].Cells.Clear();
                grdata.Rows[0].Cells.Add(new TableCell());
                grdata.Rows[0].Cells[0].ColumnSpan = count;
                grdata.Rows[0].Cells[0].Text = "There is no record in your DataBase..";
            }
        }
        catch (Exception ex)
        {
           
        }
        finally
        {
            Connection.con.Close();
        }
    }

Now i told you how to hold  value in datatable of selected column of gridview


Use the following method code of hold data in datatable which are use easily
  

  public void getSelectRows()
    {
        DataTable dt = new DataTable();
        dt.Columns.AddRange(new DataColumn[5] { new DataColumn("EmployeeID"), new DataColumn("Name"), new DataColumn("Mobile"), new DataColumn("Email"), new DataColumn("Address")});
        foreach (GridViewRow row in grdata.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox chkRow = (row.Cells[0].FindControl("chck") as CheckBox);
                Label lblName1 = (row.Cells[0].FindControl("lblName") as Label);
                Label lblId = (row.Cells[0].FindControl("lblid") as Label);
                Label lblmobile = (row.Cells[0].FindControl("lblMobile") as Label);

                Label lblAdd = (row.Cells[0].FindControl("lblAddress") as Label);
                Label lblEmail = (row.Cells[0].FindControl("lblEmail") as Label);
             

                if (chkRow.Checked)
                {
                  
                    string EmployeeID = lblId.Text;
                    string Name = lblName1.Text;
                    string Mobile = lblmobile.Text;
                    string Address = lblAdd.Text;
                    string email = lblEmail.Text;
                
                    //string Date = DateTime.Now.ToString("dd/MMM/yyyy");

                    dt.Rows.Add(EmployeeID, Name, Mobile, email, Address);
                }
            }
        }
    }

Above code use can use as select all checkbox in gridview in asp.net.

Friday, 29 April 2016

REMEDIATION SELECTION Software

REMEDIATION SELECTION Application

Hello every one today i introduce our new web-application for civil engineering. Remediation Selection is useful for building site.

A range of tools have been proposed to support decision making in contaminated land remediation.


Step One.
Step 2























Step Three
























Result Finally you get score of remediation technology .





















According to result civil engineer use that technology for construction site. This method is call remediation selection.  

How to remove shortcut virus

how to remove shortcut virus using cmd

Go to Start -> type -> cmd 
Right click on cmd and  click on run as administrator Go to your pen drive memory cards or mobile phone directory.
Type attrib -h -r -s /s /d e:*.* (Where e is the Drive Label )
And then press Enter.

Thank You

Tuesday, 26 April 2016

Simple horizontal Drop Down Menu CSS3

CSS3 Drop Down Menu 

Hello every one today i tell you how create simple drop down menu with simple animated effect using CSS3 properties.
 

Use Below Code between head tag of your html page.   

ul
{
  text-align: left;
  display: inline;
  margin: 0;
  padding: 15px 4px 17px 0;
  list-style: none;
  -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li
{
  font: bold 12px/18px sans-serif;
  display: inline-block;
  margin-right: -4px;
  position: relative;
  padding: 15px 20px;
  background: #fff;
  cursor: pointer;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -ms-transition: all 0.2s;
  -o-transition: all 0.2s;
  transition: all 0.2s;
}
ul li:hover
{
  background: #555;
  color: #fff;
}
ul li ul
{
  padding: 0;
  position: absolute;
  top: 48px;
  left: 0;
  width: 150px;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  display: none;
  opacity: 0;
  visibility: hidden;
  -webkit-transiton: opacity 0.2s;
  -moz-transition: opacity 0.2s;
  -ms-transition: opacity 0.2s;
  -o-transition: opacity 0.2s;
  -transition: opacity 0.2s;
}
ul li ul li
{
  background: #555;
  display: block;
  color: #fff;
  text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
  display: block;
  opacity: 1;
  visibility: visible;
}


Now following Code under body tag where you want horizontal menu
<ul>
<li>Home</li>
  <li>About</li>
  <li>
    Product
    <ul>
      <li>Web Design</li>
      <li>Web Development</li>
      <li>Illustrations</li>
    </ul>
  </li>
  <li>Blog</li>
  <li>Contact</li>
</ul>

Now run that page. Thank you.

Saturday, 23 April 2016

How to Fix "PageHandlerFactory-Integrated" bad module

Today i told you how to fix PageHandlerFactory-Integrated. This problem occurs when IIS is not install properly.


So just follow these steps

1. Run cmd (Run as Administrator ) 

2. type cd.. twice 

3. %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i

Note this is work for windows 64 bit Only.


Friday, 22 April 2016

Risk Assessment Software Online. A Dynamic Risk Assessment System.

RISK ASSESSMENT Software

Hello every one today i introduce my developed software RBMOCS which help to calculate Risk Assessment of Soil. This is a web application for my client.

Step1


 Step2


Step3


Step4



Step5


Step6




Step7


Step8



Result

__________________________________






In this software you can download report in word and you can see in chart also. It is basically online application for Risk Assessment for Soil. 





















How to create connection class in c# , how to attach database from mdf file, How to attach database from Pendrive

Create connection class in c#(In App-Code Folder) 

How to attach database from mdf file 

How to attach database from Pendrive


First of all open your web.config file of your application
and write this following code

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
   
   <!-- This code use when your database have password -- >
  <add name="CS"  connectionString="Data Source=VINEET-PC\SQLEXPRESS;Initial        Catalog=yourdbname;User ID=dbid;Password=dbpassword;Integrated Security=True;" providerName="System.Data.SqlClient"/>

<!-- This code use when your database with no password -- >
    <add name="CS" connectionString="Data Source=VINEET-PC\SQLEXPRESS;Initial Catalog=yourdbname;Integrated Security=True" providerName="System.Data.SqlClient"/>

<!-- This code use when your database access from other drive Suppose G is your drive -- >
     <add name="CS"  connectionString="Data Source=.\SQLExpress;AttachDbFilename=G:\youdabase.mdf;Integrated Security=True;User Instance=True;"providerName="System.Data.SqlClient" />


  </connectionStrings>
  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0"/>
    
  </system.web>
 
</configuration>

Now Create A class File in app_code folder using following code with name of Connection.cs

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;
using System.Configuration;
using System.Data;

/// <summary>
/// Summary description for Connection
/// </summary>
public class Connection
{
    public static SqlConnection con = new 
SqlConnection(ConfigurationManager.ConnectionStrings["CS"].ConnectionString) ; 
}



Now this connection file has been created
You can use your connection in any cs file like this

Connection.con.Open();
Connection.con.Close();
Connection.con

these above code is for attache database from other drive  for your application, so you use 3rd connectionstring for connection.