Click here to Skip to main content
15,906,816 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUsing Complex datatype in webservice call Pin
Tiger45626-Sep-06 20:47
Tiger45626-Sep-06 20:47 
Questionembeding .swf files into asp.net Pin
Pradip Kishore26-Sep-06 20:24
Pradip Kishore26-Sep-06 20:24 
AnswerRe: embeding .swf files into asp.net Pin
Exelioindia26-Sep-06 20:57
Exelioindia26-Sep-06 20:57 
Questionis there any tool available for monitoring state service and asp.net worker process Pin
King Shez26-Sep-06 20:20
King Shez26-Sep-06 20:20 
AnswerRe: is there any tool available for monitoring state service and asp.net worker process Pin
Sathesh Sakthivel26-Sep-06 20:41
Sathesh Sakthivel26-Sep-06 20:41 
QuestionASP.net spell checker Pin
Nitin198126-Sep-06 20:15
Nitin198126-Sep-06 20:15 
AnswerRe: ASP.net spell checker Pin
Sathesh Sakthivel26-Sep-06 20:37
Sathesh Sakthivel26-Sep-06 20:37 
QuestionProblem with the '£' symbol when exporting to Excel Pin
Am Ritha26-Sep-06 19:41
Am Ritha26-Sep-06 19:41 
Hi All,

When I Export DataGrid to Excel ,the DataGrid contains pound symbol(£).But After exporting the data to excel an unwanted character  comes prefixing the pound symbol.

can anyone please help me in eleminating the unwanted symbol.

I am attaching the code which i used for exporting.

Thank You

Reagrds,

Diffin

Ihe first step is to insert a <div > that embeds the entire Nested GridView:

<div id="divNestedGrid" runat="server">
<asp:GridView id=.. >
...
<asp:GridView .... />
---
</asp:GridView>
</asp:GridView>
</div>
Next step is add a hidden variable in the same aspx form.

<input type="hidden" id="hdnInnerHtml" value="" runat="server" />

Now add a javascript function that in the aspx that fills the hidden variable with the inner html of the div.

function getInnerHtml()
{
var element = document.getElementById("divpreview");
var store = document.getElementById("hdnInnerHtml");
//add the css styles you have used inside the nested GridView
var css = "<style type=\"text/css\" id=\"style1\">.textbold {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;font-weight: bold;text-decoration: none;}.row1 {background-color: #FFFFFF; font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;height: 18px;padding-left: 5px;}.;
store.value = css + element.innerHTML;
}

Now in the Code Behind, first add the javascript function to be triggered on the click on the Export button.

btnExport.Attributes.Add("OnClick", "getInnerHtml();");

Finally, write the following code in the Export Button click event, to Export to Excel:

string html = hdnInnerHtml.Value;
Response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
Response.Clear();
Response.AppendHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
this.EnableViewState = false;
Response.Write("\r\n");
Response.Write(html);
Response.End();



AnswerRe: Problem with the '£' symbol when exporting to Excel Pin
minhpc_bk26-Sep-06 20:52
minhpc_bk26-Sep-06 20:52 
GeneralRe: Problem with the '£' symbol when exporting to Excel Pin
Am Ritha26-Sep-06 21:06
Am Ritha26-Sep-06 21:06 
QuestionHTML Text property problem for Custom Button Control Pin
Sandip Kansara26-Sep-06 19:15
Sandip Kansara26-Sep-06 19:15 
AnswerRe: HTML Text property problem for Custom Button Control Pin
minhpc_bk26-Sep-06 19:41
minhpc_bk26-Sep-06 19:41 
QuestionClient System Time Pin
kirthikirthi26-Sep-06 19:14
kirthikirthi26-Sep-06 19:14 
AnswerRe: Client System Time Pin
minhpc_bk26-Sep-06 19:46
minhpc_bk26-Sep-06 19:46 
AnswerRe: Client System Time Pin
Exelioindia26-Sep-06 20:06
Exelioindia26-Sep-06 20:06 
QuestionAsp:Label control Pin
nannapanenikamalnath26-Sep-06 19:04
nannapanenikamalnath26-Sep-06 19:04 
Questionwhat is the reason of this .net runtime exception ? Pin
King Shez26-Sep-06 18:56
King Shez26-Sep-06 18:56 
QuestionExcel and Asp.net Pin
kavithapuranik26-Sep-06 18:55
kavithapuranik26-Sep-06 18:55 
AnswerRe: Excel and Asp.net Pin
minhpc_bk26-Sep-06 19:57
minhpc_bk26-Sep-06 19:57 
GeneralRe: Excel and Asp.net Pin
kavithapuranik26-Sep-06 20:03
kavithapuranik26-Sep-06 20:03 
GeneralRe: Excel and Asp.net Pin
minhpc_bk26-Sep-06 20:16
minhpc_bk26-Sep-06 20:16 
Questionmodule Pin
amaneet26-Sep-06 18:41
amaneet26-Sep-06 18:41 
AnswerRe: module Pin
minhpc_bk26-Sep-06 19:59
minhpc_bk26-Sep-06 19:59 
QuestionWhat is the memory limitation of ASP.Net worker process ? Pin
King Shez26-Sep-06 18:15
King Shez26-Sep-06 18:15 
AnswerRe: What is the memory limitation of ASP.Net worker process ? Pin
minhpc_bk26-Sep-06 19:52
minhpc_bk26-Sep-06 19:52 

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.