Home All Groups Group Topic Archive Search About

ASP datagrid not passing text to Excel

Author
7 Apr 2005 2:57 PM
Eric
I have an asp.net datagrid that when a user right clicks on in IE has the
option to export to Excel. everything works great but the input textbox
values come through to Excel as blank. the datagrid values in the text box
look like this(notice "4"):
input name="MyDataGrid:_ctl207:txtMatter" type="text" value="4"
id="MyDataGrid__ctl207_txtMatter" style="width:40px;" />

why is all the the other non input values on datagrid coming into Excel and
the text box values are not ?
thanks All

Author
7 Apr 2005 9:56 PM
Steve C. Orr [MVP, MCSD]
Excel can display HTML output, but it cannot accept HTML input.
Therefore input controls are not very compatible with Excel.
You should not display input controls on a form that is intended for export
to Excel.

Here's more info:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeExcel.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


Show quoteHide quote
"Eric" <E***@discussions.microsoft.com> wrote in message
news:F2264D7C-A916-4FCE-9BCD-66927B87E72F@microsoft.com...
>I have an asp.net datagrid that when a user right clicks on in IE has the
> option to export to Excel. everything works great but the input textbox
> values come through to Excel as blank. the datagrid values in the text box
> look like this(notice "4"):
> input name="MyDataGrid:_ctl207:txtMatter" type="text" value="4"
> id="MyDataGrid__ctl207_txtMatter" style="width:40px;" />
>
> why is all the the other non input values on datagrid coming into Excel
> and
> the text box values are not ?
> thanks All
Author
8 Apr 2005 1:45 AM
Eric
Thanks, Steve. It just seems rather perplexing that the values in an ASP.net
datagrid cannot pass the contents of an inputbox to the spreadsheet. The
inputbox values are populated via a DB, and are editable, yet the need to
export the values of said "editable" fields to a spreadsheet seems like a no
brainer. In fact, I have seen no less than 10 other threads (Google) with a
similar problem. The argument of “You should not display input controls on a
form that is intended for export " is rather weak, and should not be
contingent on the content of the form, but rather of the will of the user via
IE, which can be unpredictable at best. We should always code for the
unknown, which could be a user that has such a need for the input field
values, therefore exposing the weakness of your proposal. A weakness in
Microsoft, doubtful, but most likely an oversight
-Eric

Show quoteHide quote
"Steve C. Orr [MVP, MCSD]" wrote:

> Excel can display HTML output, but it cannot accept HTML input.
> Therefore input controls are not very compatible with Excel.
> You should not display input controls on a form that is intended for export
> to Excel.
>
> Here's more info:
> http://SteveOrr.net/articles/ExcelExport.aspx
> http://SteveOrr.net/articles/ExportPanel.aspx
> http://SteveOrr.net/reviews/AsposeExcel.aspx
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Eric" <E***@discussions.microsoft.com> wrote in message
> news:F2264D7C-A916-4FCE-9BCD-66927B87E72F@microsoft.com...
> >I have an asp.net datagrid that when a user right clicks on in IE has the
> > option to export to Excel. everything works great but the input textbox
> > values come through to Excel as blank. the datagrid values in the text box
> > look like this(notice "4"):
> > input name="MyDataGrid:_ctl207:txtMatter" type="text" value="4"
> > id="MyDataGrid__ctl207_txtMatter" style="width:40px;" />
> >
> > why is all the the other non input values on datagrid coming into Excel
> > and
> > the text box values are not ?
> > thanks All
>
>
>