TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chriz L
NA
220
50.6k
Export to excel selected records from gridView
Sep 20 2017 5:30 AM
Hello,
I have a new functionality that I have to add to my ASP.NET solution and I could use some help.
What I need to do is to select some records from a gridview (based on select checkbox) and export those records to an excel file.
Here's my gridView:
<
asp:GridView
ID
=
"gv"
runat
=
"server"
AutoGenerateColumns
=
"false"
ShowFooter
=
"true"
OnPageIndexChanging
=
"gv_PageIndexChanging"
AllowPaging
=
"True"
PageSize
=
"20"
>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"S/N"
ItemStyle-Width
=
"25"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblrownum"
runat
=
"server"
Text
=
'<%#Eval("rownum") %>'
Width
=
"25"
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Appno"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblAppNo"
runat
=
"server"
Text
=
'<%#Eval("Appno") %>'
Width
=
"40"
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"IDNO"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblIDNO"
runat
=
"server"
Text
=
'<%#Eval("IDNO") %>'
Width
=
"40"
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Select"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cbSelected"
runat
=
"server"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
<
PagerStyle
HorizontalAlign
=
"Left"
VerticalAlign
=
"Middle"
/>
</
asp:GridView
>
<
asp:Button
ID
=
"btnExport"
runat
=
"server"
Text
=
"Export to Excel"
/>
Any kind of help would be appreciated.
Thank you in advnce.
Reply
Answers (
2
)
Page not response on server after few times minuts
How can one user login on only one fixed system