<%@ Page Language="C#" MasterPageFile="~/MasterPage/Employee.master" AutoEventWireup="true" CodeFile="Attendance.aspx.cs" Inherits="EmployeeModule_Attendance" Title="Untitled Page" %>
<%----%>
code
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class EmployeeModule_Attendance : System.Web.UI.Page
{
REMO obj = new REMO();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View1);
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
MultiView1.SetActiveView(View2);
Grid();
}
private void Grid()
{
string q = "select convert([varchar],getdate(),(103)) as Date,Pk,EmployeeId,EmployeeName from EmpPersonal";
DataSet ds = new DataSet();
ds = obj.GETDS(q);
grdview.Visible = true;
grdview.DataSource = ds;
grdview.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdview.PageIndex = e.NewPageIndex;
Grid();
}
protected void ddlattendanceslot_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox txtin = new TextBox();
TextBox txtout = new TextBox();
DropDownList ddlat = new DropDownList();
foreach (GridViewRow row in grdview.Rows)
{
txtin = (TextBox)(grdview.Rows[row.RowIndex].Cells[5].FindControl("txttimein"));
txtout = (TextBox)(grdview.Rows[row.RowIndex].Cells[6].FindControl("txttimeout"));
ddlat = (DropDownList)(grdview.Rows[row.RowIndex].Cells[4].FindControl("ddlattendanceslot"));
string ddl = ddlat.Text;
if (ddlat.SelectedIndex == 0)
{
txtin.Enabled = false;
txtout.Enabled = false;
}
else
{
txtin.Enabled = true;
txtout.Enabled = true;
}
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Insert")
{
string dsaaa = Convert.ToString(e.CommandArgument);
}
// Grid();
// //GridView gr=grdview.Rows[e.CommandName];
// Label pkk = (Label)grdview.FooterRow.FindControl("lbpk");
// Label date = (Label)grdview.FooterRow.FindControl("lbdatee");
// Label emid = (Label)grdview.FooterRow.FindControl("lbeid");
// Label eename = (Label)grdview.FooterRow.FindControl("lename");
// DropDownList atence = (DropDownList)grdview.FooterRow.FindControl("ddlattendanceslot");
// TextBox tiin = (TextBox)grdview.FooterRow.FindControl("txttimein");
// TextBox tout = (TextBox)grdview.FooterRow.FindControl("txttimeout");
// string ars = "insert into Attendance(Date,EmpID,EmpName,AttendanceSlot,TimeIn,TimeOut) values ('" + date.Text;
// ars += "','" + emid.Text;
// ars += "','" + eename.Text;
// ars += "','" + atence.Text;
// ars += "','" + tiin.Text;
// ars += "','" + tout.Text;
// ars+="')";
// obj.Insert(ars);
}
// }
//}
//protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
//{
//}
protected void Button1_Click1(object sender, EventArgs e)
{
// Grid();
//GridView gr=grdview.Rows[e.CommandName];
Label pkk = (Label)grdview.FooterRow.FindControl("lbpppk");
Label date = (Label)grdview.FooterRow.FindControl("lbdatee");
Label emid = (Label)grdview.FooterRow.FindControl("lbeid");
Label eename = (Label)grdview.FooterRow.FindControl("lename");
DropDownList atence = (DropDownList)grdview.FooterRow.FindControl("ddlattendanceslot");
TextBox tiin = (TextBox)grdview.FooterRow.FindControl("txttimein");
TextBox tout = (TextBox)grdview.FooterRow.FindControl("txttimeout");
string ars = "insert into Attendance(Date,EmpID,EmpName,AttendanceSlot,TimeIn,TimeOut) values ('" + date;
ars += "','" + emid;
ars += "','" + eename;
ars += "','" + atence;
ars += "','" + tiin;
ars += "','" + tout;
ars += "')";
obj.Insert(ars);
}
}
values are not inserted . values cum empty thats d problem int his query
gridview the values are not inserted .

Marish BalasubramanianPosted Oct 15, 2012, 7:55 AM
(Date,EmpID,EmpName,AttendanceSlot,TimeIn,TimeOut) values ('" + date.Text;
ars += "','" + emid.Text;
ars += "','" + eename.Text;
ars += "','" + atence.SelectedItem.Text;
ars += "','" + tiin.Text;
ars += "','" + tout .Text ;
ars += "')";
obj.Insert(ars);
Dorababu MekaPosted Oct 15, 2012, 7:49 AM