Click here to Skip to main content
15,889,216 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Using server.mappath in classes (or not) Pin
Fred_Smith25-Nov-06 5:14
Fred_Smith25-Nov-06 5:14 
GeneralRe: Using server.mappath in classes (or not) Pin
iamrashida8325-Nov-06 5:37
iamrashida8325-Nov-06 5:37 
GeneralRe: Using server.mappath in classes (or not) Pin
Fred_Smith25-Nov-06 5:49
Fred_Smith25-Nov-06 5:49 
QuestionHow to get the india time zone with asp Pin
kumar.a24-Nov-06 23:45
kumar.a24-Nov-06 23:45 
AnswerRe: How to get the india time zone with asp Pin
Fred_Smith25-Nov-06 5:21
Fred_Smith25-Nov-06 5:21 
QuestionASP.NET 2.0 Web application? Pin
diovc24-Nov-06 23:43
diovc24-Nov-06 23:43 
Questionhow to take printout from the grid Pin
abulhassan_shock24-Nov-06 23:02
abulhassan_shock24-Nov-06 23:02 
AnswerRe: how to take printout from the grid Pin
pal5hah6-Oct-11 2:22
pal5hah6-Oct-11 2:22 
make this function in your .aspx.cs file

public static void PrintWebControl(Control ctrl)
{
PrintWebControl(ctrl, string.Empty);
}

public static void PrintWebControl(Control ctrl, string Script)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ctrl is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
}
Page pg = new Page();
pg.EnableEventValidation = false;
if (Script != string.Empty)
{
pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
}
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ctrl);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(strHTML);
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
}

and then on button_click event write like following

protected void printreport_Click(object sender, EventArgs e)
{
PrintWebControl(gvAnualReport);
}
Question"differ b/w viewstate and hidden fields" Pin
ravikiranreddydharmannagari24-Nov-06 22:40
ravikiranreddydharmannagari24-Nov-06 22:40 
AnswerRe: "differ b/w viewstate and hidden fields" Pin
iamrashida8325-Nov-06 5:13
iamrashida8325-Nov-06 5:13 
AnswerRe: "differ b/w viewstate and hidden fields" Pin
sam L25-Nov-06 14:05
sam L25-Nov-06 14:05 
QuestionTemporary Internet Files(urgent) Pin
hemant.kaushal24-Nov-06 22:16
hemant.kaushal24-Nov-06 22:16 
AnswerRe: Temporary Internet Files(urgent) Pin
Guffa24-Nov-06 23:28
Guffa24-Nov-06 23:28 
GeneralRe: Temporary Internet Files(urgent) Pin
hemant.kaushal24-Nov-06 23:40
hemant.kaushal24-Nov-06 23:40 
GeneralRe: Temporary Internet Files(urgent) Pin
Guffa25-Nov-06 5:26
Guffa25-Nov-06 5:26 
Questionhow to send image with email in vb 6.0 Pin
atulmandilkar24-Nov-06 21:27
atulmandilkar24-Nov-06 21:27 
AnswerRe: how to send image with email in vb 6.0 Pin
Vasudevan Deepak Kumar24-Nov-06 21:36
Vasudevan Deepak Kumar24-Nov-06 21:36 
Questionhow to send image with email in asp.net Pin
atulmandilkar24-Nov-06 21:23
atulmandilkar24-Nov-06 21:23 
AnswerRe: how to send image with email in asp.net Pin
Vasudevan Deepak Kumar24-Nov-06 21:36
Vasudevan Deepak Kumar24-Nov-06 21:36 
Questioncreate column of datagrid Pin
ptvce24-Nov-06 19:54
ptvce24-Nov-06 19:54 
AnswerRe: create column of datagrid Pin
iamrashida8325-Nov-06 5:33
iamrashida8325-Nov-06 5:33 
QuestionTrouble in using Master page and javascript ??? Pin
vicky45724-Nov-06 7:49
vicky45724-Nov-06 7:49 
AnswerRe: Trouble in using Master page and javascript ??? Pin
iamrashida8324-Nov-06 9:33
iamrashida8324-Nov-06 9:33 
GeneralRe: Trouble in using Master page and javascript ??? Pin
vicky45725-Nov-06 14:05
vicky45725-Nov-06 14:05 
AnswerRe: Trouble in using Master page and javascript ??? Pin
Grapes-R-Fun24-Nov-06 14:15
Grapes-R-Fun24-Nov-06 14:15 

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.