jamie_pattison
Well-known member
- Joined
- Sep 9, 2008
- Messages
- 116
- Programming Experience
- Beginner
I am using a HttpContext to write all gridview data to Excel.
The problem i have is with any templatefields that are bound their data is not exported i.e.
They dont export across. Im using a For each loop for the column names and rows to iterate through the rows which are successfully exported, i then wrote some code to convert any LinkButton to a literal control i.e.
but the same issue remains which is all template fields with a value is not exported across but other fields are.
Could anyone advise how i could get the value?
Thanks
The problem i have is with any templatefields that are bound their data is not exported i.e.
VB.NET:
<asp:TemplateField HeaderText="Value">
<ItemTemplate>
<asp:LinkButton ID="Completevalue" runat="server" Text='<%# Eval("SalesValue") %>' OnClick="GetSalesTotal" CommandArgument='<%# Eval("ID") %>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
They dont export across. Im using a For each loop for the column names and rows to iterate through the rows which are successfully exported, i then wrote some code to convert any LinkButton to a literal control i.e.
VB.NET:
If TypeOf Currentctrl Is LinkButton Then
control.Controls.Remove(current)
control.Controls.AddAt(i, New LiteralControl(DirectCast(currentCtrl, LinkButton).Text))
but the same issue remains which is all template fields with a value is not exported across but other fields are.
Could anyone advise how i could get the value?
Thanks