How to fetch data from database on mouse over event using ASP.Net C#.
If user move to mouse hover on his details then data should be displayed in tooltip or any another.
I have two table first "emp" and second "asset"
I have prepared to displyed data from "emp" table but i unable to display data from "asset " table in tooltip or any another.
CREATE TABLE [dbo].[emp] (
[EMP_ID] NVARCHAR (10) NOT NULL,
[PROJECT_ID] NVARCHAR (10) NULL,
[EMP_NAME] NVARCHAR (50) NULL,
[EMP_DSG] NVARCHAR (35) NULL,
[DEPT_ID] NVARCHAR (15) NULL,
[EMP_ADD] NVARCHAR (50) NULL,
[LOCATION_ID] NVARCHAR (50) NULL,
[EMP_DOB] NVARCHAR (15) NULL,
[DOJNTPC] NVARCHAR (50) NULL,
[PHONE_RESI] NVARCHAR (50) NULL,
[PHONE_OFF] NVARCHAR (50) NULL,
[VSAT_PHONE] NVARCHAR (50) NULL,
[EMAIL_ID] NCHAR (40) NULL,
[INTERCOM] NVARCHAR (50) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[PHONE_MOB] NCHAR (12) NULL,
[photo] IMAGE NULL,
[IsActive] BIT NULL,
[password] NVARCHAR (50) NULL
);
CREATE TABLE [dbo].[asset] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[empid] NCHAR (10) NULL,
[name] NCHAR (10) NULL,
[asset_no] NCHAR (100) NULL,
[sl_no] NCHAR (100) NULL,
[asset_cd _SAP] NCHAR (100) NULL,
[mk_mdl] NCHAR (100) NULL,
[stats] NCHAR (100) NULL,
[purpos] NCHAR (100) NULL,
[lcn] NCHAR (100) NULL,
[pr_no] NCHAR (100) NULL,
[po_no] NCHAR (100) NULL,
[dt] DATE NULL,
[doc] DATE NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
<asp:DataList ID="DataList1" runat="server" VerticalAlign="Center" RepeatLayout="Table" RepeatDirection="Vertical" RepeatColumns="6" Width="1612px" Style="text-align: left">
<ItemTemplate>
<div style="border: 2px solid #ccc;">
<asp:Image ID="Image1" ImageUrl='<%#Eval("photo") %>' runat="server" hight='30' Width="200" Visible="true" />
<br />
<b>Emp. ID.:</b>
<asp:Label ID="Label7" Text='<%# Eval("EMP_ID") %>' runat="server" />
<br />
<b>EMP_NAME:</b>
<asp:Label ID="Label3" Text='<%#Eval("EMP_NAME") %>' runat="server" />
<br />
<b>DEPT_ID:</b>
<asp:Label ID="Label1" Text='<%#Eval("DEPT_ID") %>' runat="server" />
<br />
</ItemTemplate>
</asp:DataList>
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindListView();
}
}
private void BindListView()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT * FROM emp where PROJECT_ID='1003 '";
// cmd.CommandText = "SELECT Name,Dates,Images FROM ImageDate WHERE Month(GETDATE()) = month(dates) and Day(GETDATE()) = day(Dates) and year(GETDATE())= year(Dates)";
cmd.Connection = con;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
}
}
}
}
Need your help.
please sir.