CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 12/23/2005 6:16:54 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 0 Views: 120 Favorited: 0 Favorite
1 Items, 1 Pages 1 |< << Go >> >|
fudata
Asp.Net User
Gridview won't export to MS Excel12/23/2005 6:16:54 PM

0

I am developing an ASP.NET 2.0 Web page using Visual Web Developer.
My page has three gridviews which have its own SqlDataSource's. I want my  intranet users (who can access this page only after correct Windows Server Domain logon) export those gridviews data to MS Excel by 'right-clicking' on the gridview. It is a great built-in feature of gridview which does not require any coding. My problem is only second gridview successfully exports the table.


When I right-click and chose 'Export to Microsoft Excel' menu on the first and third gridview, Excel opens up and showed an error message :

"This Web query returned no data. To modify the query, click OK, click the name of the external data range in the name box on the formula bar, and then click Edit Query on the External Data toolbar."

I searched MS site and got an article about this message (http://support.microsoft.com/default.aspx?SCID=kb;en-us;277596) and it says table of gridview maybe password protected, which I can't understand because I am working on the same developing machine which runs IIS and VWD together. SQL server is remote, though. My user ID is the database owner of the remote SQL server and had no problem accessing the databse. That's why I don't think it is really a securury issue. Besides, why the second gridview CAN export succesfully then?

The cause may not be in the difference of gridview designs but in how the gridviews access data source. But to my understanding, web query from Excel does not invoke data connection to the database but extracts information from HTML already displayed in the browser.  

Here I attach a part of my source file about the three gridviews. Any comment will be welcome.

===============================================================================
...
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
            BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
            CellPadding="0" DataSourceID="SqlDataSource_Shiplist" ForeColor="Black"
            GridLines="Vertical" style="z-index: 100; left: 320px; position: absolute; top: 92px"
            DataKeyNames="Sort_Number,Kit_Number"
            DataMember="DefaultView" ToolTip="Right-click and choose 'Export to Excel' for output and printing."
            Caption="Contents of shiplist file" CaptionAlign="Left" Font-Names="Verdana"
            Font-Size="Small" EnableTheming="True">
            <FooterStyle BackColor="#CCCCCC" />
            <Columns>
...
            </Columns>
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:GridView>
---------------------------------------------------------------------------------
        <asp:GridView ID="GridView2" runat="server" AllowSorting="True" AutoGenerateColumns="False"
            BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
            CellPadding="0" DataSourceID="SqlDataSource_Parts" ForeColor="Black"
            GridLines="Vertical" style="z-index: 108; left: 320px; position: absolute; top: 92px" DataKeyNames="Kit_Number"
            ToolTip="Right-click and choose 'Export to Excel' for output and printing." Caption="List of Shiplists"
            CaptionAlign="Left" Font-Bold="False" Font-Names="Verdana" Font-Size="Small" TabIndex="2">
            <FooterStyle BackColor="#CCCCCC" />
            <Columns>
...
            </Columns>
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:GridView>
----------------------------------------------------------------------------------
        <asp:GridView ID="GridView3" runat="server" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="Solid"
            BorderWidth="1px" Caption="Merged Shiplist" CaptionAlign="Left" CellPadding="3"
            DataKeyNames="Part_Number" DataSourceID="SqlDataSource_MergedShiplist" Font-Names="Verdana"
            Font-Size="Small" ForeColor="Black" GridLines="Vertical" Style="z-index: 110;
            left: 320px; position: absolute; top: 88px" Width="392px" TabIndex="3">
            <Columns>
                <asp:BoundField DataField="Part_Number" HeaderText="Part_Number" SortExpression="Part_Number" />
                <asp:BoundField DataField="QtyReq" HeaderText="QtyReqTotal" SortExpression="QtyReq" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            </Columns>
            <RowStyle Font-Names="Verdana" Font-Size="X-Small" />
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />        
            <HeaderStyle BackColor="Black" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small"
                ForeColor="White" />
            <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:GridView>

===============================================================================

1 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Matt Berseth: Export GridView to Excel I googled as "export gridview to excel" and this blog was on the first page. ...... Until then, it won't appear on the entry. Thanks for waiting.) ...
Export GridView to Excel within an UpdatePanel by JohnnyCoder If you need a “simple” way to export your GridView to Excel and you are .... it to your export to excel button. That way you won’t get the System.WebForms. ...
CodeProject: How to export GridView to Excel, render cells, add ... Export Gridview to Excel, render cells, add WordArt, and fill a custom template. ; ... Quit() call //doesn't always do the job private void killExcel() { try ...
export datatable/gridview to excel with no formatting - ASP.NET Forums Filed under: .Net 2.0, excel ADODB asp.net, gridview .... Export it to csv if you want, you won't have any formatting. Cheers,. Anwar Buchoo. ~ Luckyhuss ~ ...
ASP.net Gridview Export to Excel, it works but bombs with large ... I'm using this to export a gridview to excel, the problem being that once i hit over 10000 records or so, it doesn't change and just displays the gridview. ...
The Gridview to Excel Export Tool What this tool doesn't require. Since this tool produces Excel 2003 xml files and ... Download the Gridview to Excel Export Tool from the best download ...
Download The Gridview to Excel Export Tool, The Gridview to Excel ... Microsoft AdventureWorks demo database N.B.:The Demo Site code is Visual Basic. you can free download The Gridview to Excel Export Tool 1.3.2 now. ...
ASP.Net 2.0: Export GridView to Excel Srikanth, To what export format are you exporting the gridview data in? MS Excel has a limit of 65536 rows, so you won't be able to view all the data in a ...
p2p.wrox.com Forums - Adding to Export Of GridView to Excel Secondly, my Gridview control doesn't use gridlines, but I'd like the Excel doc to ... ContentType = "application/ms-excel" Dim sw As IO. ...
CodeSnip: Exporting GridView to Excel: ASP Alliance Title: Still won't work for me Name: Matt Date: 12/24/2006 1:46:29 PM Comment: I tried using this code to export my gridview into excel and I keep getting ...






automatic login to other sites

admin and profiles

login controls

windows authentication problem

ajax createuserwizard and adding multiple users

parsing aspnet_profile table fields

roles based autnetication not working

can i set folder nt permissions programmatically?

to use login control or not, can i add more fields?

problems with password recovery control

converting from login control to custom implementation

why i cannot get username through user.identity.name

2.0 authentication with existing users table...?

user login

c# -- auto-generate email with verification link

asp:createuserwizard - standard control with added checkbox not validating now?? plz plz help.

set cookie for membership provider

help with the createuserwizard!

how to handle membership methods that are useless to us in our 'custom' provider?

domain validation form user entered input?

file permissions, access denied to system32

forms authentication ticket timeout

unauthorizedaccessexception in connecting to remote system

web site administration tool

security & impersonation

hide a textbox for specified role

restrict access from outside the office

using a aspnet 2.0 logon app with native asp, is this possible

forms authentication using session variables

autofill login

   
  Privacy | Contact Us
All Times Are GMT