Click here to Skip to main content
15,898,134 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAjaX TIMER will not start in ascx Pin
Cannery18-Aug-08 13:05
Cannery18-Aug-08 13:05 
QuestionAJAX Accordion control Pin
Cannery18-Aug-08 7:15
Cannery18-Aug-08 7:15 
Questionhow to get all employee id in to single variable? Pin
ram6718-Aug-08 6:49
ram6718-Aug-08 6:49 
AnswerRe: how to get all employee id in to single variable? Pin
Manas Bhardwaj18-Aug-08 7:21
professionalManas Bhardwaj18-Aug-08 7:21 
AnswerCP IGNORE Pin
leckey18-Aug-08 11:45
leckey18-Aug-08 11:45 
AnswerRe: how to get all employee id in to single variable? Pin
Christian Graus18-Aug-08 11:53
protectorChristian Graus18-Aug-08 11:53 
Questiontrying to use master detail grids !!! Pin
mrkeivan18-Aug-08 6:42
mrkeivan18-Aug-08 6:42 
Questionhow to display the datas in single row? Pin
ram6718-Aug-08 6:00
ram6718-Aug-08 6:00 
am using .net 2005.i am doing my project in asp.net.
my project title is master log attendance.
i want to display datas in single row for same name and id.
i have 2 table named as attendance and employeedetails.

The following code has worked very well.But datas are displayed in multiple row for same name and id.

protected void img_submit_Click(object sender, ImageClickEventArgs e)
{
from_date = txt_fr_date.Text;
to_date = txt_to_date.Text;
emp_name = ddl_emp_name.SelectedValue;
check();
}
void check()
{

System.TimeSpan dt_diff = Convert.ToDateTime(to_date).Subtract(Convert.ToDateTime(from_date));
days = dt_diff.Days;


dt.Columns.Add(new DataColumn("ID", typeof(string)));
dt.Columns.Add(new DataColumn("Name", typeof(string)));


for (int i = 0; i <= days; i++)

{
sql_date = Convert.ToDateTime(from_date).AddDays(i).ToString("MM/dd/yyyy");
sql_date1 = Convert.ToDateTime(from_date).AddDays(i).ToString("MM/dd/yyyy");


dt.Columns.Add(new DataColumn(sql_date1, typeof(string)));
drow = dt.NewRow();

com = new SqlCommand("select distinct rpt.emp_id as EmployeeID,card.username as EmployeeName,min(case when rpt.datetime1='" + sql_date + "' then rpt.datetime1 end) as '" + sql_date + "' from tbl_card as card,tbl_report as rpt where card.fkdata=rpt.emp_id and rpt.datetime1='" + sql_date + "' and emp_id='366' group by rpt.emp_id,card.username", con);
dr = com.ExecuteReader();
while (dr.Read())
{
drow[0] = dr.GetString(0);
drow[1] = dr.GetString(1);

drow[i+2] ="x";
dt.Rows.Add(drow);
}
dr.Close();


}



GV_musterrole.DataSource = new DataView(dt);
GV_musterrole.DataBind();

}

in above code,i applied query with groupby and distinct in for loop statement.
using above code,the following output is coming in grid view,

--ID----Name---10/11/2007--10/12/2007--10/13/2007--10/14/2007--10/15/2007
--366--dinesh---------------------------x
--366--dinesh-------------------------------------------x
--366--dinesh---------------------------------------------------------------x
here 3 lines are displayed using for loop statement for same name and id.
But I want to display in single line using for loop statement for same name and id as following output.How to do this?
--ID----Name---10/11/2007--10/12/2007--10/13/2007--10/14/2007--10/15/2007
--366--dinesh---------------------------x-----------------x----------------x
QuestionHow can I get Page PreRender to work? Pin
davebarkshire18-Aug-08 5:40
davebarkshire18-Aug-08 5:40 
AnswerRe: How can I get Page PreRender to work? Pin
Abhijit Jana18-Aug-08 6:13
professionalAbhijit Jana18-Aug-08 6:13 
GeneralRe: How can I get Page PreRender to work? Pin
davebarkshire18-Aug-08 6:19
davebarkshire18-Aug-08 6:19 
GeneralRe: How can I get Page PreRender to work? Pin
N a v a n e e t h19-Aug-08 3:10
N a v a n e e t h19-Aug-08 3:10 
Questionproblem in ajax toolkit's control while proper working someplace same code Pin
UD(IA)18-Aug-08 4:53
UD(IA)18-Aug-08 4:53 
AnswerRe: problem in ajax toolkit's control while proper working someplace same code Pin
Tripathi Swati18-Aug-08 19:46
Tripathi Swati18-Aug-08 19:46 
GeneralDowngrade to 1.1 from 2.0 Pin
Brady Kelly18-Aug-08 4:53
Brady Kelly18-Aug-08 4:53 
QuestionOn page focus Pin
omlac18-Aug-08 3:09
omlac18-Aug-08 3:09 
AnswerRe: On page focus Pin
Guffa18-Aug-08 3:52
Guffa18-Aug-08 3:52 
QuestionImage Display in IE7 Pin
Anand Desai18-Aug-08 3:08
Anand Desai18-Aug-08 3:08 
AnswerRe: Image Display in IE7 Pin
NeverHeardOfMe18-Aug-08 7:02
NeverHeardOfMe18-Aug-08 7:02 
Questionviewstate MAC failed error.........urgent Pin
trilokharry18-Aug-08 3:05
trilokharry18-Aug-08 3:05 
AnswerRe: viewstate MAC failed error.........urgent Pin
alanemin18-Aug-08 7:20
alanemin18-Aug-08 7:20 
AnswerEVERYTHING YOU POST IS URGENT Pin
leckey18-Aug-08 11:47
leckey18-Aug-08 11:47 
QuestionMultiple strings on one line of a list box Pin
Gretna18-Aug-08 2:57
Gretna18-Aug-08 2:57 
AnswerRe: Multiple strings on one line of a list box Pin
Abhijit Jana18-Aug-08 6:08
professionalAbhijit Jana18-Aug-08 6:08 
GeneralRe: Multiple strings on one line of a list box Pin
Gretna22-Aug-08 3:03
Gretna22-Aug-08 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.