Click here to Skip to main content
16,007,687 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: save txt file on client computer Pin
eyeseetee8-Oct-08 2:47
eyeseetee8-Oct-08 2:47 
AnswerRe: save txt file on client computer Pin
Venkatesh Mookkan8-Oct-08 17:27
Venkatesh Mookkan8-Oct-08 17:27 
QuestionCross database compatibility Pin
Bardy858-Oct-08 0:52
Bardy858-Oct-08 0:52 
QuestionAdd control to panel Runtime Pin
omlac7-Oct-08 23:49
omlac7-Oct-08 23:49 
AnswerRe: Add control to panel Runtime Pin
eyeseetee7-Oct-08 23:54
eyeseetee7-Oct-08 23:54 
GeneralRe: Add control to panel Runtime Pin
omlac8-Oct-08 0:07
omlac8-Oct-08 0:07 
QuestionExport Datagrid to Excel using ASP.Net Pin
mullamootil7-Oct-08 23:36
mullamootil7-Oct-08 23:36 
AnswerRe: Export Datagrid to Excel using ASP.Net Pin
HemJoshi7-Oct-08 23:53
HemJoshi7-Oct-08 23:53 
Hi,
Can you explain how you are exporting data to excel....It will help to get ur problem solve quickly..

If u want you can use the below code for exporting the data in excel.....

private void btnExportToExcel_Click(object sender, System.EventArgs e)
{
dataGrid1.DataSource=TT_Reports.getDefaultersList(DateTime.Parse(TxtFromDate.Text),DateTime.Parse(TxtToDate.Text ),ddnTeamList.SelectedValue.ToString());
dataGrid1.DataBind();
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
Response.AddHeader("content-disposition", "attachment;filename=DefaultersList_"+DateTime.Today.ToShortDateString()+".xls");
this.ClearControls(dataGrid1);
dataGrid1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}



private void ClearControls(Control control)
{
for (int i=control.Controls.Count -1; i>=0; i--)
{
ClearControls(control.Controls[i]);
}
if (!(control is TableCell))
{
if (control.GetType().GetProperty("SelectedItem") != null)
{
LiteralControl literal = new LiteralControl();
control.Parent.Controls.Add(literal);
try
{
literal.Text = (string)control.GetType().GetProperty("SelectedItem").GetValue(control,null);
}
catch
{
}
control.Parent.Controls.Remove(control);
}
else
if (control.GetType().GetProperty("Text") != null)
{
LiteralControl literal = new LiteralControl();
control.Parent.Controls.Add(literal);
literal.Text = (string)control.GetType().GetProperty("Text").GetValue(control,null);
control.Parent.Controls.Remove(control);
}
}
return;
}
GeneralRe: Export Datagrid to Excel using ASP.Net Pin
mullamootil8-Oct-08 20:14
mullamootil8-Oct-08 20:14 
AnswerRe: Export Datagrid to Excel using ASP.Net Pin
Sneha Bisht8-Oct-08 1:44
Sneha Bisht8-Oct-08 1:44 
GeneralRe: Export Datagrid to Excel using ASP.Net Pin
calf20088-Oct-08 15:17
calf20088-Oct-08 15:17 
QuestionProblem with Placeholder control [modified] Pin
eyeseetee7-Oct-08 23:30
eyeseetee7-Oct-08 23:30 
AnswerRe: Problem with Placeholder control Pin
thomasa8-Oct-08 0:01
thomasa8-Oct-08 0:01 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 0:15
eyeseetee8-Oct-08 0:15 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 1:16
thomasa8-Oct-08 1:16 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 0:21
eyeseetee8-Oct-08 0:21 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 1:18
thomasa8-Oct-08 1:18 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 1:23
eyeseetee8-Oct-08 1:23 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 1:28
eyeseetee8-Oct-08 1:28 
GeneralRe: Problem with Placeholder control [modified] Pin
thomasa8-Oct-08 1:58
thomasa8-Oct-08 1:58 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:26
eyeseetee8-Oct-08 2:26 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:31
eyeseetee8-Oct-08 2:31 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 3:16
thomasa8-Oct-08 3:16 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 3:40
thomasa8-Oct-08 3:40 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 4:12
eyeseetee8-Oct-08 4:12 

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.