|
How u r getting this "23.14:33:01" value, I mean in which variable u are saving it, can u please post the hole code???
|
|
|
|
|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class ExtEltSetTimeStamp : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
label3.Text = " Showing COMPLETED Elements ";
if (Session != null)
{
}
else
{
Response.Redirect("Login.aspx");
}
if (!Page.IsPostBack)
{
GridView1.PageIndex = 0;
GridView2.PageIndex = 0;
fillgridview();
label2.Text = "1 out of" + GridView1.PageCount;
label2.Text = "1 out of" + GridView2.PageCount;
GridView2.Visible = false;
}
}
public void fillgridview()
{
DataSet ds;
// DataRow[] dr;
try
{
int y = 0;
bool iscompleted = false;
DateTime submitted = DateTime.Today;
DateTime completed = DateTime.MinValue;
TimeSpan ts;
//DataTable tbliscompleted = new DataTable();
//DataTable tblinprogress = new DataTable();
//string columnname="";
//ds = clsSqlDataProvider.ExtElement_GetRequisitionTime(Convert.ToInt32(Session["LoginId"].ToString()), "1");
clsSqlDataProvider dp = new clsSqlDataProvider();
ds = dp.ExtElement_GetRequisitionTime(112, "1");
DataTable dtCompleted = new DataTable();
dtCompleted.Columns.Add("Description", System.Type.GetType("System.String"));
dtCompleted.Columns.Add("Scope", System.Type.GetType("System.String"));
dtCompleted.Columns.Add("GICSCodeDesc", System.Type.GetType("System.String"));
dtCompleted.Columns.Add("SubmittedDate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("DcDate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("EADate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("HUDate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("PSDate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("DUDate", System.Type.GetType("System.DateTime"));
dtCompleted.Columns.Add("TotalTimeTakentoComplete(Days)", System.Type.GetType("System.TimeSpan"));
//dtCompleted.Columns.Add("TotalTimeTakentoComplete(Days)", System.Type.GetType("System.Int32"));
DataTable dtInProgress = new DataTable();
dtInProgress = dtCompleted;
DataRow[] drows;
string nReqID = "";
while (y < ds.Tables[0].Rows.Count)
{
DataRow drDT;
drDT = dtCompleted.NewRow();
nReqID = ds.Tables[0].Rows[y][0].ToString();
drDT[0] = ds.Tables[0].Rows[y][1].ToString();
drDT[1] = ds.Tables[0].Rows[y][5].ToString();
drDT[2] = ds.Tables[0].Rows[y][7].ToString();
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=2 and NewAddStatus=3");
if (drows != null && drows.Length > 0)
{
//foreach (DataRow drow in drows)
//{
// submitted = drow[3];
//}
submitted = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
iscompleted = false;
drDT[3] = submitted.ToString();
}
else
{
drDT[3] = DBNull.Value;
}
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=2 and NewAddStatus=2");
if (drows != null && drows.Length > 0)
{
completed = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
drDT[4] = completed.ToString();
//string [7] StrDay = completed.split(new char {'.'})
}
else
{
drDT[4] = DBNull.Value;
}
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=3 and NewAddStatus=2");
if (drows != null && drows.Length > 0)
{
completed = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
drDT[5] = completed.ToString();
}
else
{
drDT[5] = DBNull.Value;
}
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=4 and NewAddStatus=2");
if (drows != null && drows.Length > 0)
{
completed = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
drDT[6] = completed.ToString();
}
else
{
drDT[6] = DBNull.Value;
}
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=5 and NewAddStatus=2");
if (drows != null && drows.Length > 0)
{
completed = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
drDT[7] = completed.ToString();
}
else
{
drDT[7] = DBNull.Value;
}
drows = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=6 and NewAddStatus=2");
if (drows != null && drows.Length > 0)
{
completed = Convert.ToDateTime(drows[drows.Length - 1][3].ToString());
iscompleted = true;
drDT[8] = completed.ToString();
}
else
{
drDT[8] = DBNull.Value;
}
if (iscompleted == true)
{
//completed.Subtract(14);
ts = completed - submitted;
//ts = completed.Subtract(submitted);
//DateTime tsh=Convert.ToDateTime - submitted.Hour;
//ts = tsh;
//DateTime tsm = completed.Minute - submitted.Minute;
//DateTime tss = completed.Minute - submitted.Minute;
//int intDays = ts.Days;
//drDT[9] = intDays;
drDT[9] = ts;
dtCompleted.Rows.Add(drDT);
}
else
{
if (completed == DateTime.MinValue)
{
drDT[9] = "0";
}
else
{
ts = completed - submitted;
// ts = completed.Subtract(submitted);
//int intDays = ts.Days;
if (ts.Ticks > 0)
{
drDT[9] = ts.ToString();
}
else
{
drDT[9] = 0.ToString();
}
}
dtInProgress.Rows.Add(drDT);
}
y += 1;
}
GridView1.DataSource = dtCompleted;
GridView1.DataBind();
GridView2.DataSource = dtInProgress;
GridView2.DataBind();
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
fillgridview();
label2.Text = e.NewPageIndex + 1 + " out of " + GridView1.PageCount;
}
public void fillgrid()
{
DataSet ds;
try
{
int y = 0;
bool isprogress = false;
DateTime submitted = DateTime.Today;
DateTime progress = DateTime.MinValue;
TimeSpan ts1;
//ds = clsSqlDataProvider.ExtElement_GetRequisitionTime(Convert.ToInt32(Session["LoginId"].ToString()), "1");
clsSqlDataProvider dp = new clsSqlDataProvider();
ds = dp.ExtElement_GetRequisitionTime(112, "1");
DataTable tblinprogress = new DataTable();
tblinprogress.Columns.Add("Description", System.Type.GetType("System.String"));
tblinprogress.Columns.Add("Scope", System.Type.GetType("System.String"));
tblinprogress.Columns.Add("GICSCodeDesc", System.Type.GetType("System.String"));
tblinprogress.Columns.Add("SubmittedDate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("DcDate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("EADate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("HUDate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("PSDate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("DUDate", System.Type.GetType("System.DateTime"));
tblinprogress.Columns.Add("TotalTimeTakentoComplete(Days)", System.Type.GetType("System.TimeSpan"));
DataRow[] drows1;
string nReqID = "";
while (y < ds.Tables[0].Rows.Count)
{
DataRow drDT1;
drDT1 = tblinprogress.NewRow();
nReqID = ds.Tables[0].Rows[y][0].ToString();
drDT1[0] = ds.Tables[0].Rows[y][1].ToString();
drDT1[1] = ds.Tables[0].Rows[y][5].ToString();
drDT1[2] = ds.Tables[0].Rows[y][7].ToString();
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=2 and NewAddStatus=3");
if (drows1 != null && drows1.Length > 0)
{
//foreach (DataRow drow in drows)
//{
// submitted = drow[3];
//}
submitted = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
isprogress = false;
drDT1[3] = submitted.ToString();
}
else
{
drDT1[3] = DBNull.Value;
}
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=2 and NewAddStatus=2");
if (drows1 != null && drows1.Length > 0)
{
progress = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
drDT1[4] = progress.ToString();
}
else
{
drDT1[4] = DBNull.Value;
}
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=3 and NewAddStatus=2");
if (drows1 != null && drows1.Length > 0)
{
progress = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
drDT1[5] = progress.ToString();
}
else
{
drDT1[5] = DBNull.Value;
}
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=4 and NewAddStatus=2");
if (drows1 != null && drows1.Length > 0)
{
progress = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
drDT1[6] = progress.ToString();
}
else
{
drDT1[6] = DBNull.Value;
}
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=5 and NewAddStatus=2");
if (drows1 != null && drows1.Length > 0)
{
progress = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
drDT1[7] = progress.ToString();
}
else
{
drDT1[7] = DBNull.Value;
}
drows1 = ds.Tables[1].Select("Reqid=" + nReqID + "And NewStatus=6 and NewAddStatus=2");
if (drows1 != null && drows1.Length > 0)
{
progress = Convert.ToDateTime(drows1[drows1.Length - 1][3].ToString());
isprogress = true;
drDT1[8] = progress.ToString();
}
else
{
drDT1[8] = DBNull.Value;
}
if (isprogress == true)
{
ts1 = submitted - progress;
drDT1[9] = ts1;
}
else
{
if (progress == DateTime.MinValue)
{
drDT1[9] = "0";
}
else
{
ts1 = submitted - progress;
if (ts1.Ticks > 0)
{
drDT1[9] = ts1.ToString();
}
else
{
drDT1[9] = 0.ToString();
}
}
}
tblinprogress.Rows.Add(drDT1);
y += 1;
}
GridView2.DataSource = tblinprogress;
GridView2.DataBind();
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
GridView1.Visible = false;
GridView2.Visible = true;
Label1.Text = "Showing IN PROGRESS Elements";
label3.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
GridView2.Visible = false;
Label1.Text = "Showing COMPLETED Elements";
label3.Visible = false;
}
protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView2.PageIndex = e.NewPageIndex;
fillgridview();
label2.Text = e.NewPageIndex + 1 + "out of " + GridView2.PageCount;
}
}
|
|
|
|
|
i have set the data from database through form view..all the rows came with insert item template..but while running the page the form view is not coming.i want to add the item in running time.in sqldatasource properties there is also isert quiry..while click on quirybuilder,it showing insert quiry error cant pass string.wht z the solution
|
|
|
|
|
Hello Everybody,
I want to design a gridview where there is a option to create a new row for the user. suppose there is a button and by clicking the button a new blank row added to the gridview. The user can add more than one row. If possible make the button present in a column of the gridview so that when the user click the button a new row created along with the button column also.
plz give some idea to do or the solution.
Happy Coding...
AS@13
AS
|
|
|
|
|
You can take a look at this[^]. This will help you out in that.
Apurva Kaushal
|
|
|
|
|
Hi,
Thanks yaar..
But it not solve my problem...
the problem is that the button should be in last column of the Gridview and user can create more than one row as per the requirement..
plz help me out..
Happy Coding
AS
|
|
|
|
|
Regarding the columns you can have it where ever you want. And for adding multiple rows once he has added one record afterwards he can again add another one.
Apurva Kaushal
|
|
|
|
|
But I also want to display those new entries in gridview to the user. plz send me the code if u have.
Thanks
AS
|
|
|
|
|
Once he has added the row you can bind the gridview again after that you will get the gridview with the added row.
Apurva Kaushal
|
|
|
|
|
|
Always welcome..
Apurva Kaushal
|
|
|
|
|
Hi, i need to do paging in datalist / datagrid, like the scenario i write below. All the values are fetching from database. in this case the paging options are A-C, D-G, ... I hope you people can understand. I need its solution little urgent.
Please give me any suggestion.
------------------------------------------------------------------------------------------------------
A - C D - G H - K L - N O - R S - V W - Z
A
ABB | Acme | AC Tech Drives | Adalet | Advance | AEG | Allied Molded Products | Amprobe | Asco
B
Bernstein | B-Line | Bodine
C
Cablofil | Carlo Gavazzi | Carlon | Coleman | Cooper | Crouse-Hinds | Cooper Power | Cooper Wiring | Cully
Regards, Sohail Arshed
|
|
|
|
|
Have a custom Paging build in the Footer Template of the DataList Control using Link Buttons with the Command argument as "A,B,C" for the first link button and "D,E,F,G" for the second and so on... On the ItemCommand Event of the DataList Control call the DB procedure by passing the Command argument and get the appropriate records and Bind them.
- Regards - JON Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
|
|
|
|
|
Dropdown list has two properties called TextField and ValueField
When ur TextField is 2008-2009 assign value field to 2007-2008 and same for all other rows..
|
|
|
|
|
First tell me how many values are possible in this dropdown list...
|
|
|
|
|
Is there a page event called when we use response.redirect to redirect to any other page? The reason is that i want to perform some actions just before the page is redirected.
Thx in advance
Bye
|
|
|
|
|
Then what is the issue? First perform the actions and then redirect the user to the desired page.
Apurva Kaushal
|
|
|
|
|
I am a bit apprehensive whether it will work or not.. Try it once..I wrote a code for a similar requirement and its working ....
u can call some events..
u will have create a different class
public void Init(HttpApplication context)
{
(IsDisposed)
{
throw (new ObjectDisposedException(this.ToString()));
}
else
{
context.BeginRequest +=new EventHandler(context_BeginRequest);
context.EndRequest += new EventHandler(context_EndRequest);
}
}
//This function will get called before ending exection of any page.
private void context_EndRequest(object sender, EventArgs e)
{
if (((HttpApplication)sender).Context.CurrentHandler.ToString() != "UR_PAGE_NAME")
{
//Ur Code
}
}
|
|
|
|
|
Prateek G wrote: public void Init(HttpApplication context)
{
(IsDisposed)
{
throw (new ObjectDisposedException(this.ToString()));
}
What is this IsDisposed, im getting error on it in vb.net. Also tell me who will set the value of the context and can I integrate it directly to the Page_Init event.
Bye
|
|
|
|
|
ohh I am sorry, Remove that if condition dont use it....
|
|
|
|
|
public void Init(HttpApplication context)
{
(IsDisposed)
{
can you please tell me how to get the httpApplication context in my page_init parameters or if it is a method when shud i call it and what parameter shud i pass in it
Bye
|
|
|
|
|
Hi All,
I need to accept a file from end user and convert it to pdf and after converting the file it should show a dialog box which has open, save and cancel button (the way we have while downloading a file).
If the end user say open then it should be embedded in IE and if the end user say save it then it should be saved on end users machine.
Please help me...
Thanks in advance...
|
|
|
|
|
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + sFileName + ".pdf");
Response.BinaryWrite(urFileStream);
// or if u have byte[] u can use Response.OutputStream.Write(byteArray,0,byteArray.Length);
Response.End();
|
|
|
|
|
Hi Prateek,
Thanks for the reply, what is urFileStream in the line Response.BinaryWrite(urFileStream);
Also I need to download the file also or embedd in IE. Can u please tell me how do I do this..
Thanks again...
|
|
|
|
|
Whatever file u r having u need to convert it to either in stream or in byte[] and then u can add it with Response... Everything else will be taken care...
Just check navneeth's post I guess there are some limitation on this kind of conversion. Here I am just changing the extension of file to .pdf but I dont know whether it will work with all kinds of files or not.....
|
|
|
|