I have a need to input a large tab delimited text file, which I will parse
to check it has the expected columns, before allowing the user to submit it
to the database. The user may paste the file into a textbox, or upload it
(haven't decided yet).
The problem I have is that the text file consists of around 3000 lines, and
I want to display the formatted columns to the user before submitting it to
the database (perhaps allowing them to edit some fields if they want, before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::
How can I page the data in the grid, without having to parse the text each
time - i.e. where can I 'store' the parsed text so that I use that during my
paging operations (prior to inserting it into the database)?
Thanks,
JJ 13 2779
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:
I have a need to input a large tab delimited text file, which I will parse
to check it has the expected columns, before allowing the user to submit it
to the database. The user may paste the file into a textbox, or upload it
(haven't decided yet).
The problem I have is that the text file consists of around 3000 lines, and
I want to display the formatted columns to the user before submitting it to
the database (perhaps allowing them to edit some fields if they want, before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::
How can I page the data in the grid, without having to parse the text each
time - i.e. where can I 'store' the parsed text so that I use that during my
paging operations (prior to inserting it into the database)?
Thanks,
JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm
mistaken, that each time you change the page index, you need to rebind the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?
JJ
<pb*******@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:
>I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file into a textbox, or upload it (haven't decided yet).
The problem I have is that the text file consists of around 3000 lines, and I want to display the formatted columns to the user before submitting it to the database (perhaps allowing them to edit some fields if they want, before clicking submit). Clearly 3000 lines is too much to display on one gridview page - so the question is::
How can I page the data in the grid, without having to parse the text each time - i.e. where can I 'store' the parsed text so that I use that during my paging operations (prior to inserting it into the database)?
Thanks, JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
"JJ" <ab*@xyz.comwrote in message
news:uU**************@TK2MSFTNGP02.phx.gbl...
Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm
mistaken, that each time you change the page index, you need to rebind the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?
JJ
Why don't you save the data in the temporary table in the database? Once
user confirmed the changes you will copy all data to the real table.
Store the DataTable in Session after you've first constructed it.
Get it back out of Session after changing the PageIndex and rebind:
grid.CurrrentPageIndex =e.newPageIndex;
DataTable myTable = (DataTable)Session["myDataTable"];
grid.DataSource=myTable;
grid.DataBind();
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm
mistaken, that each time you change the page index, you need to rebind the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?
JJ
<pb*******@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:
I have a need to input a large tab delimited text file, which I will
parse
to check it has the expected columns, before allowing the user to submit
it
to the database. The user may paste the file into a textbox, or upload it
(haven't decided yet).
The problem I have is that the text file consists of around 3000 lines,
and
I want to display the formatted columns to the user before submitting it
to
the database (perhaps allowing them to edit some fields if they want,
before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::
How can I page the data in the grid, without having to parse the text
each
time - i.e. where can I 'store' the parsed text so that I use that during
my
paging operations (prior to inserting it into the database)?
Thanks,
JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
Is there a limit to how large the datatable can be within a Session
variable? We're talking a 3000 line tab delimited text file here.
JJ
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:63**********************************@microsof t.com...
Store the DataTable in Session after you've first constructed it.
Get it back out of Session after changing the PageIndex and rebind:
grid.CurrrentPageIndex =e.newPageIndex;
DataTable myTable = (DataTable)Session["myDataTable"];
grid.DataSource=myTable;
grid.DataBind();
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
>Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm mistaken, that each time you change the page index, you need to rebind the grid to the datatable. I lose the contents of that datatable on each refresh. To recreate it I need to parse the text again, which will be a lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted datatable throughout postbacks. Could I write the gridview as a user control and use viewstate for such a large datatable perhaps?
JJ
<pb*******@gmail.comwrote in message news:11**********************@q75g2000hsh.googleg roups.com...
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote: I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file into a textbox, or upload it (haven't decided yet).
The problem I have is that the text file consists of around 3000 lines, and I want to display the formatted columns to the user before submitting it to the database (perhaps allowing them to edit some fields if they want, before clicking submit). Clearly 3000 lines is too much to display on one gridview page - so the question is::
How can I page the data in the grid, without having to parse the text each time - i.e. where can I 'store' the parsed text so that I use that during my paging operations (prior to inserting it into the database)?
Thanks, JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
On Jun 7, 9:51 pm, "JJ" <a...@xyz.comwrote:
Is there a limit to how large the datatable can be within a Session
variable? We're talking a 3000 line tab delimited text file here.
It depends on the web server's memory. Storing large objects in a
user's session is maybe not always a good idea because of performance
but storing and reloading data from memory will be faster than any
other method.
As Alexey said. A 3000 line text file (or the DataTable you get from
converting it) isn't going to bring down your server. But, if it is
user-specific and you have to use Session, and you have a lot of users, well
- you can do the math.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
Is there a limit to how large the datatable can be within a Session
variable? We're talking a 3000 line tab delimited text file here.
JJ
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:63**********************************@microsof t.com...
Store the DataTable in Session after you've first constructed it.
Get it back out of Session after changing the PageIndex and rebind:
grid.CurrrentPageIndex =e.newPageIndex;
DataTable myTable = (DataTable)Session["myDataTable"];
grid.DataSource=myTable;
grid.DataBind();
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm
mistaken, that each time you change the page index, you need to rebind
the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?
JJ
<pb*******@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:
I have a need to input a large tab delimited text file, which I will
parse
to check it has the expected columns, before allowing the user to
submit
it
to the database. The user may paste the file into a textbox, or upload
it
(haven't decided yet).
The problem I have is that the text file consists of around 3000
lines,
and
I want to display the formatted columns to the user before submitting
it
to
the database (perhaps allowing them to edit some fields if they want,
before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so
the
question is::
How can I page the data in the grid, without having to parse the text
each
time - i.e. where can I 'store' the parsed text so that I use that
during
my
paging operations (prior to inserting it into the database)?
Thanks,
JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
Looks like storing it in a temp table in the database may be the way to go
then,
Thanks,
JJ
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:FA**********************************@microsof t.com...
As Alexey said. A 3000 line text file (or the DataTable you get from
converting it) isn't going to bring down your server. But, if it is
user-specific and you have to use Session, and you have a lot of users,
well
- you can do the math.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
>Is there a limit to how large the datatable can be within a Session variable? We're talking a 3000 line tab delimited text file here.
JJ
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in message news:63**********************************@microsof t.com...
Store the DataTable in Session after you've first constructed it.
Get it back out of Session after changing the PageIndex and rebind:
grid.CurrrentPageIndex =e.newPageIndex;
DataTable myTable = (DataTable)Session["myDataTable"];
grid.DataSource=myTable;
grid.DataBind();
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"JJ" wrote:
Hi Peter,
Thats what I've done (used a dataTable that is). But I notice, unless I'm mistaken, that each time you change the page index, you need to rebind the grid to the datatable. I lose the contents of that datatable on each refresh. To recreate it I need to parse the text again, which will be a lengthy process if the text file is 3000 lines.
I'm therefore at a loss as to how to keep hold of the large, formatted datatable throughout postbacks. Could I write the gridview as a user control and use viewstate for such a large datatable perhaps?
JJ
<pb*******@gmail.comwrote in message news:11**********************@q75g2000hsh.googleg roups.com...
On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote: I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file into a textbox, or upload it (haven't decided yet).
The problem I have is that the text file consists of around 3000 lines, and I want to display the formatted columns to the user before submitting it to the database (perhaps allowing them to edit some fields if they want, before clicking submit). Clearly 3000 lines is too much to display on one gridview page - so the question is::
How can I page the data in the grid, without having to parse the text each time - i.e. where can I 'store' the parsed text so that I use that during my paging operations (prior to inserting it into the database)?
Thanks, JJ
JJ,
What I'd consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter
On Jun 7, 11:03 pm, "JJ" <a...@xyz.comwrote:
Looks like storing it in a temp table in the database may be the way to go
then,
Thanks,
JJ
If you go this way, create a table with columns you need to get from
Excel and an additional column for SessionId (varchar 25). And use
that SessionId to identify data of the current user.
To clean table you can create a sql job and schedule to run... (in
this case you might also need to have a datetime column to know when
data were added)
Good point - I didn't think of that.
Thanks,
JJ
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@n4g2000hsb.googlegro ups.com...
On Jun 7, 11:03 pm, "JJ" <a...@xyz.comwrote:
>Looks like storing it in a temp table in the database may be the way to go then, Thanks, JJ
If you go this way, create a table with columns you need to get from
Excel and an additional column for SessionId (varchar 25). And use
that SessionId to identify data of the current user.
To clean table you can create a sql job and schedule to run... (in
this case you might also need to have a datetime column to know when
data were added)
It doesn't look like I'm able to access the sql agent to create a scheduled
job. Perhaps I could check for records which are 24 hours old when I do
another insert/delete etc and remove them then?
Thanks,
JJ
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@n4g2000hsb.googlegro ups.com...
On Jun 7, 11:03 pm, "JJ" <a...@xyz.comwrote:
>Looks like storing it in a temp table in the database may be the way to go then, Thanks, JJ
If you go this way, create a table with columns you need to get from
Excel and an additional column for SessionId (varchar 25). And use
that SessionId to identify data of the current user.
To clean table you can create a sql job and schedule to run... (in
this case you might also need to have a datetime column to know when
data were added)
On Jun 8, 11:46 am, "JJ" <a...@xyz.comwrote:
It doesn't look like I'm able to access the sql agent to create a scheduled
job. Perhaps I could check for records which are 24 hours old when I do
another insert/delete etc and remove them then?
Yes, it could be a good idea. In general, you need to delete temporary
data when the user has been confirmed the changes and the data have
been transferred to a working table. But I think it could be a
situation where an user did imported his data to that temporary table,
and didn't confirmed... So, in this case you will need this kind of
cleaning function
Yes - exactly my thoughts. I intend to delete each record with the current
sessionID as it is inserted into the final database table, but, as this is
quiet a lot of data, and the user may close the browser just after adding to
the temp table and before committing to the final table, I think that before
I insert any data into the temp table, I should run some sql:
DELETE
Temp_Table
WHERE
DATEDIFF (hour , AddedDate , GetDate(); ) 2
to delete any records older than 2 hours.
Thanks,
JJ
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
On Jun 8, 11:46 am, "JJ" <a...@xyz.comwrote:
>It doesn't look like I'm able to access the sql agent to create a scheduled job. Perhaps I could check for records which are 24 hours old when I do another insert/delete etc and remove them then?
Yes, it could be a good idea. In general, you need to delete temporary
data when the user has been confirmed the changes and the data have
been transferred to a working table. But I think it could be a
situation where an user did imported his data to that temporary table,
and didn't confirmed... So, in this case you will need this kind of
cleaning function This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Henry |
last post by:
I have a large number of user define class objects and want display in a
datagrid and able to perform paging and column sorting. It seems using
DataView is the easiest way but the objects are not...
|
by: ck388 |
last post by:
For some reason when I enable the callback feature of the gridview I
still get a page refresh, that is it seems like there is a postback
that occurs, not a callback which is just supposed to update...
|
by: Guoqi Zheng |
last post by:
Sir,
The default paging of datagrid is somehow use too much resource, so I am
using Stored procedure for the paging. You can find my Stored procedure at
the end of this message.
It works...
|
by: Matthew Curiale |
last post by:
I am creating an app that lists clients of a company for management of
different attributes for that company. The first page is a listing of
the companies currently in the database. I have my...
|
by: tfsmag |
last post by:
Hello,
I have a function that returns a dynamically created gridview. This
works fine, however it does not seem to be able to maintain state when
adding sorting or paging to the gridview. Does...
| |
by: anonieko |
last post by:
This approach I found very efficient and FAST when compared to the
rowcount, or Subquery Approaches.
This is before the advent of a ranking function from DB such as
ROW_NUMBER() in SQL Server...
|
by: Marc Grutte |
last post by:
Hi
I am trying to bind a custom datasource to a gridview whilst paging is
enabled. What is missing in this code to make the paging + binding work?
thanks
M
<%@ Page Language="VB" %>
|
by: John A Grandy |
last post by:
In regard to a GridView that must support searching, filtering, sorting, and
paging ...
There is a tradeoff in performing the sorting and paging in the database
versus to creating a CLR sort...
|
by: jrod11 |
last post by:
hi,
I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| | |