In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "the file output stream mode of GridView control in ASP.NET". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the file output stream mode of the GridView control in ASP.NET".
ASP.NET provides a variety of data server controls for displaying table data in a database in a Web page, and the GridView control is one of them. This control is almost the same as the DataGridView control we have learned before, so we are no stranger to the GridView control.
The first step: set up the Columns column you need for gridview and bind the data. The data of my first column is because the format of "day, month, year, hour, minute and second" is saved in the database. When I export it, I add a dataformatstring value "{0:yyyy-MM-dd}", the format of year, month and day, so that the output time format is 2016-08-07, which looks better.
Step 2: bind the data, write the query method, then bind your query method directly to DataSource, and then
Bind your gridview so that you have the value you need
Step 3:
Except for the for loop part, the rest is fine according to me. Mine is the file output of adding nodes. If you just want to output all the data displayed by your grdview, you can just write the code that circulates your gridview data source, plus a loop j, the stringBuilder that I use here, data splicing, a column that shows what I need.
Step 4: set a button click event in the page, call this method, and the file will be generated automatically. According to the date, the code generated by the date is: Response.AddHeader (@ "Content-Disposition", "attachment; filename=" + DateTime.Now.ToString ("_ yyyyMMdd_HHmmss") + ".txt"); you can also modify its splicing format.
At this point, I believe that you have a deeper understanding of the file output stream mode of the GridView control in ASP.NET, so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.