如何将数据从gridview导出到excel。我试过很多次,帮帮我。 [英] How to export data from gridview to excel.? I tried many times, help me.

查看:64
本文介绍了如何将数据从gridview导出到excel。我试过很多次,帮帮我。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server.





我尝试了什么:





What I have tried:

<form id="form1" runat="server">
<table id="wrapper" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table id="maintable" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="headtd">
                    </td>
                </tr>
                <tr>
                    <td class="br">
                    </td>
                </tr>
                <tr>
                    <td class="menutd">
                        <div class="top_menu_nav" id="chromemenu">
                            <ul>
                                <li><a href="AddMembership.aspx" title="ADDMEMBER" >ADDMEMBER</a></li>
                                <li><a href="ShowMemberDetails.aspx" title="MEMBERDETAILS" class="current">SHOWMEMBER</a></li>
                                <li><a href="Login.aspx" title="Contact">LOGOUT</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="br">
                    </td>
                </tr>
                <tr>
                    <td class="contenttd" valign="top">
                        <table id="content" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="leftcon">
                                    <table id="divcontent" align="center" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td valign="top">
                                                <div align="center">
                                                    <table class="inner" align="center">
                                                        <tr>
                                                            <td>
                                                                MEMBER DETAILS
                                                            </td>
                                                        </tr>
                                                        <tr><td></td></tr>
                                                        <tr><td>
                                                            <asp:GridView ID="GridView1" runat="server"

                                                                style="font-size: large; font-family: 'Times New Roman', Times, serif"

                                                                AutoGenerateColumns="False">
                                                                <Columns>
                                                                    <asp:BoundField DataField="Name" HeaderText="Name" />
                                                                    <asp:BoundField DataField="Father Name" HeaderText="Father Name" />
                                                                    <asp:BoundField DataField="Address" HeaderText="Address" />
                                                                    <asp:BoundField DataField="Village" HeaderText="Village" />
                                                                    <asp:BoundField DataField="District" HeaderText="District" />
                                                                    <asp:BoundField DataField="Mobile" HeaderText="Mobile" />
                                                                </Columns>
                                                            </asp:GridView>
                                                        </td></tr>
                                                    </table>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td class="centre">
                                    <%-- THis is CEntre--%>
                                </td>
                                <td class="rightcon">
                                    <table class="righttable" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td>
                                                <asp:Button ID="Button1" runat="server" Text="Export"

                                                    Style="margin-top: -166px" onclick="Button1_Click" />
                                                <%--  USe SOMe --%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="br">
                    </td>
                </tr>
                <tr>
                    <td class="foottd" valign="middle">
                        <span class="cpyrgt">Copyrights @ Sri SivaSelvi Amman Temple </span><span class="powered">
                            Powered By <a href="http://www.globalsoftinfotech.co.in" target="_blank">Globalsoft
                                Infotech</a></span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</form>

推荐答案

Hope this will help:



c# - GridView must be placed inside a form tag with runat=\"server\" even after the GridView is within a form tag - Stack Overflow[^]
Hope this will help:

c# - GridView must be placed inside a form tag with runat="server" even after the GridView is within a form tag - Stack Overflow[^]


这篇关于如何将数据从gridview导出到excel。我试过很多次,帮帮我。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆