Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Export datagrid(with allowsorting) to Excel (http://www.velocityreviews.com/forums/t58154-export-datagrid-with-allowsorting-to-excel.html)

Cowboy \(Gregory A. Beamer\) 06-25-2003 01:19 PM

Re: Export datagrid(with allowsorting) to Excel
 
In this instance, since you know what the user wants when you query the
data, I would consider sorting the data on the server when you pull the
data. I am not sure why it bombs (I would have to examine the HTML
produced), but it is easily solved by sorting on the Data tier and avoiding
the issue on the Presentation tier.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"Eric" <Eric_Zsz@hotmail.com> wrote in message
news:uEQiEKxODHA.3152@TK2MSFTNGP10.phx.gbl...
Dear All,

I want to export datagrid content to a Excel file, the code just like
below:

Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
gridList.Columns(0).Visible = False
gridList.Columns(1).SortExpression = ""
gridList.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()

....

If my datagrid Allowsorting=true, then the code run error,but if I
config the Allowsorting=false, then above code run fine.
Please help me how to export if my datagrid has the allowsorting
properity.

Any help welcomes.

Best Regards,
Eric.



George Durzi 06-25-2003 08:52 PM

Re: Export datagrid(with allowsorting) to Excel
 
what he said, sort on the data layer

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netRemuvThis> wrote in
message news:OduJ3xxODHA.452@TK2MSFTNGP11.phx.gbl...
> In this instance, since you know what the user wants when you query the
> data, I would consider sorting the data on the server when you pull the
> data. I am not sure why it bombs (I would have to examine the HTML
> produced), but it is easily solved by sorting on the Data tier and

avoiding
> the issue on the Presentation tier.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> Author: ADO.NET and XML: ASP.NET on the Edge
>
>

************************************************** **************************
> ****
> Think Outside the Box!
>

************************************************** **************************
> ****
> "Eric" <Eric_Zsz@hotmail.com> wrote in message
> news:uEQiEKxODHA.3152@TK2MSFTNGP10.phx.gbl...
> Dear All,
>
> I want to export datagrid content to a Excel file, the code just like
> below:
>
> Response.ContentType = "application/vnd.ms-excel"
> Response.Charset = ""
> Me.EnableViewState = False
> Dim tw As New System.IO.StringWriter()
> Dim hw As New System.Web.UI.HtmlTextWriter(tw)
> gridList.Columns(0).Visible = False
> gridList.Columns(1).SortExpression = ""
> gridList.RenderControl(hw)
> Response.Write(tw.ToString())
> Response.End()
>
> ...
>
> If my datagrid Allowsorting=true, then the code run error,but if I
> config the Allowsorting=false, then above code run fine.
> Please help me how to export if my datagrid has the allowsorting
> properity.
>
> Any help welcomes.
>
> Best Regards,
> Eric.
>
>




CJM 06-26-2003 09:44 AM

Re: Export datagrid(with allowsorting) to Excel
 
He can probably tell you how to set your clock...



Alex B 06-26-2003 05:19 PM

Re: Export datagrid(with allowsorting) to Excel
 
Here's how... Go to the first message that you post dated. Then from the
Message menu in OE, choose Block Sender.

"Eric" <Eric_Zsz@hotmail.com> wrote in message
news:%23kJBsf3ODHA.1336@TK2MSFTNGP11.phx.gbl...
> Would you like to tell me how to do?
> Thanks.
>
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netRemuvThis>

写入消息
> 新闻:OduJ3xxODHA.452@TK2MSFTNGP11.phx.gbl...
> > In this instance, since you know what the user wants when you query the
> > data, I would consider sorting the data on the server when you pull the
> > data. I am not sure why it bombs (I would have to examine the HTML
> > produced), but it is easily solved by sorting on the Data tier and

> avoiding
> > the issue on the Presentation tier.
> >
> > --
> > Gregory A. Beamer
> > MVP; MCP: +I, SE, SD, DBA
> > Author: ADO.NET and XML: ASP.NET on the Edge
> >
> >

>

************************************************** **************************
> > ****
> > Think Outside the Box!
> >

>

************************************************** **************************
> > ****
> > "Eric" <Eric_Zsz@hotmail.com> wrote in message
> > news:uEQiEKxODHA.3152@TK2MSFTNGP10.phx.gbl...
> > Dear All,
> >
> > I want to export datagrid content to a Excel file, the code just

like
> > below:
> >
> > Response.ContentType = "application/vnd.ms-excel"
> > Response.Charset = ""
> > Me.EnableViewState = False
> > Dim tw As New System.IO.StringWriter()
> > Dim hw As New System.Web.UI.HtmlTextWriter(tw)
> > gridList.Columns(0).Visible = False
> > gridList.Columns(1).SortExpression = ""
> > gridList.RenderControl(hw)
> > Response.Write(tw.ToString())
> > Response.End()
> >
> > ...
> >
> > If my datagrid Allowsorting=true, then the code run error,but if I
> > config the Allowsorting=false, then above code run fine.
> > Please help me how to export if my datagrid has the allowsorting
> > properity.
> >
> > Any help welcomes.
> >
> > Best Regards,
> > Eric.
> >
> >

>
>




=?gb2312?B?RXJzaW4gR2VuP3SouXJr?= 06-27-2003 11:28 AM

Re: Export datagrid(with allowsorting) to Excel
 
hi eric,

are you getting some error like 'link item must be placed into form tag with an attribute runat=server" if so then your problem is because of when you use htmltextwriter and render control into it where your grids sorting property set to true then link items generate this error because your htmltextwriter doesn't include form tag.try including some form tag into htmltextwriter or , first disable allowsorting property to false , then export to excel and then rebind your dataset with allowsorting set to true (also this has some side effects where grid losts page numbers. etc)

regards,
ersin gen?türk


"Eric" <Eric_Zsz@hotmail.com> wrote in message news:uEQiEKxODHA.3152@TK2MSFTNGP10.phx.gbl...
Dear All,

I want to export datagrid content to a Excel file, the code just like below:

Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
gridList.Columns(0).Visible = False
gridList.Columns(1).SortExpression = ""
gridList.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()

...

If my datagrid Allowsorting=true, then the code run error,but if I config the Allowsorting=false, then above code run fine.
Please help me how to export if my datagrid has the allowsorting properity.

Any help welcomes.

Best Regards,
Eric.



Eric 07-03-2003 12:15 PM

Export datagrid(with allowsorting) to Excel
 
Dear All,

I want to export datagrid content to a Excel file, the code just like below:

Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
gridList.Columns(0).Visible = False
gridList.Columns(1).SortExpression = ""
gridList.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()

....

If my datagrid Allowsorting=true, then the code run error,but if I config the Allowsorting=false, then above code run fine.
Please help me how to export if my datagrid has the allowsorting properity.

Any help welcomes.

Best Regards,
Eric.



Eric 07-04-2003 12:21 AM

Re: Export datagrid(with allowsorting) to Excel
 
Would you like to tell me how to do?
Thanks.

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netRemuvThis> 写入消息
新闻:OduJ3xxODHA.452@TK2MSFTNGP11.phx.gbl...
> In this instance, since you know what the user wants when you query the
> data, I would consider sorting the data on the server when you pull the
> data. I am not sure why it bombs (I would have to examine the HTML
> produced), but it is easily solved by sorting on the Data tier and

avoiding
> the issue on the Presentation tier.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> Author: ADO.NET and XML: ASP.NET on the Edge
>
>

************************************************** **************************
> ****
> Think Outside the Box!
>

************************************************** **************************
> ****
> "Eric" <Eric_Zsz@hotmail.com> wrote in message
> news:uEQiEKxODHA.3152@TK2MSFTNGP10.phx.gbl...
> Dear All,
>
> I want to export datagrid content to a Excel file, the code just like
> below:
>
> Response.ContentType = "application/vnd.ms-excel"
> Response.Charset = ""
> Me.EnableViewState = False
> Dim tw As New System.IO.StringWriter()
> Dim hw As New System.Web.UI.HtmlTextWriter(tw)
> gridList.Columns(0).Visible = False
> gridList.Columns(1).SortExpression = ""
> gridList.RenderControl(hw)
> Response.Write(tw.ToString())
> Response.End()
>
> ...
>
> If my datagrid Allowsorting=true, then the code run error,but if I
> config the Allowsorting=false, then above code run fine.
> Please help me how to export if my datagrid has the allowsorting
> properity.
>
> Any help welcomes.
>
> Best Regards,
> Eric.
>
>





All times are GMT. The time now is 09:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.