Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Export to excel selected records from gridView
Chriz L
7y
185
1
Reply
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.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Page not response on server after few times minuts
How can one user login on only one fixed system