I am looking for some way to persist a table web control so when page_load
event comes up, i can display the table as it was. I tried using ViewState
with the rows collection but that didn't work to well as I got an error
trying to put rows collection in the viewstate.
My problem is this:
I load a table with rows and controls, then wire events, this is after
clearing the rows of the table initially in this function.
When clicking a particular button, I want it to reload the page based on
data in this button, problem is, every page load I clear the table and
repopulate it. So the particular button is wiped and a new one created, I
think this is what is causing things to act funky. Is storing the rows
collection as a rows collection (in session. viewstate. or class variable)
my best option? Is there another way? i tried using datagrid and
databinding, but I had problems figuring out how to place controls in rows
with datagrid, and the table works great up to this point. So I wanted to
get past this hurddle and maybe re-write it into a better contol later. 8 1796
"John Smith Jr." <me@isp.com> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl... I am looking for some way to persist a table web control so when page_load event comes up, i can display the table as it was. I tried using
ViewState with the rows collection but that didn't work to well as I got an error trying to put rows collection in the viewstate.
My problem is this:
I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
When clicking a particular button, I want it to reload the page based on data in this button, problem is, every page load I clear the table and repopulate it. So the particular button is wiped and a new one created, I think this is what is causing things to act funky. Is storing the rows collection as a rows collection (in session. viewstate. or class variable) my best option? Is there another way? i tried using datagrid and databinding, but I had problems figuring out how to place controls in rows with datagrid, and the table works great up to this point. So I wanted to get past this hurddle and maybe re-write it into a better contol later.
I am not sure I am getting this correctly, but do you use the !IsPostBack in
your Page_Load? If it is an Web control and ViewState is in use for that
control, it should keep track of its data all by itself as long as you do
not recreate it on postbacks.
Rocky Moore www.HintsAndTips.com
Well the first problem is the table contains dynamic controls and events in
each row.
But i have tried only populate on page_load that isn't a post back and the
table is always empty for me.
I tried putting my populate table code in the !Page.IsPostBack and the table
is blank on PostBack.
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:up**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9**************@TK2MSFTNGP09.phx.gbl... I am looking for some way to persist a table web control so when
page_load event comes up, i can display the table as it was. I tried using ViewState with the rows collection but that didn't work to well as I got an error trying to put rows collection in the viewstate.
My problem is this:
I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
When clicking a particular button, I want it to reload the page based on data in this button, problem is, every page load I clear the table and repopulate it. So the particular button is wiped and a new one created,
I think this is what is causing things to act funky. Is storing the rows collection as a rows collection (in session. viewstate. or class
variable) my best option? Is there another way? i tried using datagrid and databinding, but I had problems figuring out how to place controls in
rows with datagrid, and the table works great up to this point. So I wanted
to get past this hurddle and maybe re-write it into a better contol later.
I am not sure I am getting this correctly, but do you use the !IsPostBack
in your Page_Load? If it is an Web control and ViewState is in use for that control, it should keep track of its data all by itself as long as you do not recreate it on postbacks.
Rocky Moore www.HintsAndTips.com
"John Smith Jr." <me@isp.com> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl... Well the first problem is the table contains dynamic controls and events
in each row.
But i have tried only populate on page_load that isn't a post back and the table is always empty for me.
I tried putting my populate table code in the !Page.IsPostBack and the
table is blank on PostBack.
You say you want it to display the table based on the "data in the button".
What data would this be? Can you store that data in your viewstate and
simply post back an ID to that date so that your routine generates the
proper table? Is there an example?
Rocky Moore www.HintsAndTips.com
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message news:up**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9**************@TK2MSFTNGP09.phx.gbl... I am looking for some way to persist a table web control so when page_load event comes up, i can display the table as it was. I tried using ViewState with the rows collection but that didn't work to well as I got an
error trying to put rows collection in the viewstate.
My problem is this:
I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
When clicking a particular button, I want it to reload the page based
on data in this button, problem is, every page load I clear the table and repopulate it. So the particular button is wiped and a new one
created, I think this is what is causing things to act funky. Is storing the
rows collection as a rows collection (in session. viewstate. or class variable) my best option? Is there another way? i tried using datagrid and databinding, but I had problems figuring out how to place controls in rows with datagrid, and the table works great up to this point. So I
wanted to get past this hurddle and maybe re-write it into a better contol
later.
I am not sure I am getting this correctly, but do you use the
!IsPostBack in your Page_Load? If it is an Web control and ViewState is in use for
that control, it should keep track of its data all by itself as long as you
do not recreate it on postbacks.
Rocky Moore www.HintsAndTips.com
Page Load
UpdateTable()
UpdateTable()
Get List of Data
Clear Table
Populate Table with Data
Populate Table (last cell) with control buttons
Wire events for buttons
Event
Button.Attribute[""]
UpdateTable() with new data (ie drill down the data in table)
As you can see, Page_Load calls clear table to repopulate it.
Now this is removing the old controls/events, so events arn't firing
properly.
Since I am using dynamic controls/events, I some how need to keep the same
controls/event wired up, I believe what is happening now is when Page_load
is called, it clears the table, creates new rows and buttons/events, since
these events arnt' the same as the last pass, when the button click event
would normally fire (after page-load) it doesn't cause it no longer exists
(at least the instance that was called, the button still exists as it was
recreated, but it is a "new" button).
So I was looking to save the old table out with the contols so on page load
I can simple reload them, and on button click, I can do the update.
I am fairly new to ASP.NET, so I might be missing something, but I beeen
struggling with this for a while now.
The code can be viewed at www.vampired.net/code.txt this is an old copy,
but shows the same problem.
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:eF**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP**************@TK2MSFTNGP10.phx.gbl... Well the first problem is the table contains dynamic controls and events in each row.
But i have tried only populate on page_load that isn't a post back and
the table is always empty for me.
I tried putting my populate table code in the !Page.IsPostBack and the table is blank on PostBack.
You say you want it to display the table based on the "data in the
button". What data would this be? Can you store that data in your viewstate and simply post back an ID to that date so that your routine generates the proper table? Is there an example?
Rocky Moore www.HintsAndTips.com
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message news:up**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9**************@TK2MSFTNGP09.phx.gbl... > I am looking for some way to persist a table web control so when page_load > event comes up, i can display the table as it was. I tried using ViewState > with the rows collection but that didn't work to well as I got an error > trying to put rows collection in the viewstate. > > My problem is this: > > I load a table with rows and controls, then wire events, this is
after > clearing the rows of the table initially in this function. > > When clicking a particular button, I want it to reload the page
based on > data in this button, problem is, every page load I clear the table
and > repopulate it. So the particular button is wiped and a new one
created, I > think this is what is causing things to act funky. Is storing the rows > collection as a rows collection (in session. viewstate. or class
variable) > my best option? Is there another way? i tried using datagrid and > databinding, but I had problems figuring out how to place controls
in rows > with datagrid, and the table works great up to this point. So I wanted to > get past this hurddle and maybe re-write it into a better contol later. >
I am not sure I am getting this correctly, but do you use the !IsPostBack in your Page_Load? If it is an Web control and ViewState is in use for that control, it should keep track of its data all by itself as long as you do not recreate it on postbacks.
Rocky Moore www.HintsAndTips.com
Hello,
John Smith Jr. wrote: Since I am using dynamic controls/events, I some how need to keep the same controls/event wired up, I believe what is happening now is when Page_load is called, it clears the table, creates new rows and buttons/events, since these events arnt' the same as the last pass, when the button click event would normally fire (after page-load) it doesn't cause it no longer exists (at least the instance that was called, the button still exists as it was recreated, but it is a "new" button).
You can re-create the dynamically created controls during Page_Load
and handle the events, but you have to ensure that the IDs of the
dynamically created controls stay the same !
Assign the IDs yourself instead of using automatic ID assignment.
With automatic assignment, the ID of the button in the same row
will differ when you create it in Page_Load and Button_Click.
As a result, ASP.NET can't pass the post data to the right button control.
Best regards,
Eric
"John Smith Jr." <me@isp.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl... Page Load UpdateTable()
UpdateTable() Get List of Data Clear Table Populate Table with Data Populate Table (last cell) with control buttons Wire events for buttons
Event Button.Attribute[""] UpdateTable() with new data (ie drill down the data in table)
As you can see, Page_Load calls clear table to repopulate it. Now this is removing the old controls/events, so events arn't firing properly.
Since I am using dynamic controls/events, I some how need to keep the same controls/event wired up, I believe what is happening now is when Page_load is called, it clears the table, creates new rows and buttons/events, since these events arnt' the same as the last pass, when the button click event would normally fire (after page-load) it doesn't cause it no longer exists (at least the instance that was called, the button still exists as it was recreated, but it is a "new" button).
So I was looking to save the old table out with the contols so on page
load I can simple reload them, and on button click, I can do the update.
I am fairly new to ASP.NET, so I might be missing something, but I beeen struggling with this for a while now.
The code can be viewed at www.vampired.net/code.txt this is an old copy, but shows the same problem.
This may not be quite what you want to hear, but the code works fine for me
..NET V1.0 ;)
There must be something higher than this which is the problem. Does the
document have SessionsState and ViewState enabled?
Do you know "where" it is losing the click event? That is, does it post
back, go through the creation of the table and buttons with the proper
directory (last one used to build the table)?
You might throw in more traces to make sure it is building the tables and
buttons the same and that the name IDs.
Rocky Moore www.HintsAndTips.com
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message news:eF**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP**************@TK2MSFTNGP10.phx.gbl... Well the first problem is the table contains dynamic controls and
events in each row.
But i have tried only populate on page_load that isn't a post back and the table is always empty for me.
I tried putting my populate table code in the !Page.IsPostBack and the table is blank on PostBack.
You say you want it to display the table based on the "data in the button". What data would this be? Can you store that data in your viewstate and simply post back an ID to that date so that your routine generates the proper table? Is there an example?
Rocky Moore www.HintsAndTips.com
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message news:up**************@tk2msftngp13.phx.gbl... > > "John Smith Jr." <me@isp.com> wrote in message > news:e9**************@TK2MSFTNGP09.phx.gbl... > > I am looking for some way to persist a table web control so when page_load > > event comes up, i can display the table as it was. I tried using > ViewState > > with the rows collection but that didn't work to well as I got an error > > trying to put rows collection in the viewstate. > > > > My problem is this: > > > > I load a table with rows and controls, then wire events, this is after > > clearing the rows of the table initially in this function. > > > > When clicking a particular button, I want it to reload the page based on > > data in this button, problem is, every page load I clear the table and > > repopulate it. So the particular button is wiped and a new one created, I > > think this is what is causing things to act funky. Is storing the
rows > > collection as a rows collection (in session. viewstate. or class variable) > > my best option? Is there another way? i tried using datagrid and > > databinding, but I had problems figuring out how to place controls in rows > > with datagrid, and the table works great up to this point. So I wanted to > > get past this hurddle and maybe re-write it into a better contol later. > > > > I am not sure I am getting this correctly, but do you use the !IsPostBack in > your Page_Load? If it is an Web control and ViewState is in use for that > control, it should keep track of its data all by itself as long as
you do > not recreate it on postbacks. > > Rocky Moore > www.HintsAndTips.com > > >
The very first click works, but after that it requires two clicks
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message
news:O3**************@TK2MSFTNGP12.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:uI**************@TK2MSFTNGP11.phx.gbl... Page Load UpdateTable()
UpdateTable() Get List of Data Clear Table Populate Table with Data Populate Table (last cell) with control buttons Wire events for buttons
Event Button.Attribute[""] UpdateTable() with new data (ie drill down the data in table)
As you can see, Page_Load calls clear table to repopulate it. Now this is removing the old controls/events, so events arn't firing properly.
Since I am using dynamic controls/events, I some how need to keep the
same controls/event wired up, I believe what is happening now is when
Page_load is called, it clears the table, creates new rows and buttons/events,
since these events arnt' the same as the last pass, when the button click
event would normally fire (after page-load) it doesn't cause it no longer
exists (at least the instance that was called, the button still exists as it
was recreated, but it is a "new" button).
So I was looking to save the old table out with the contols so on page load I can simple reload them, and on button click, I can do the update.
I am fairly new to ASP.NET, so I might be missing something, but I beeen struggling with this for a while now.
The code can be viewed at www.vampired.net/code.txt this is an old
copy, but shows the same problem.
This may not be quite what you want to hear, but the code works fine for
me .NET V1.0 ;)
There must be something higher than this which is the problem. Does the document have SessionsState and ViewState enabled?
Do you know "where" it is losing the click event? That is, does it post back, go through the creation of the table and buttons with the proper directory (last one used to build the table)?
You might throw in more traces to make sure it is building the tables and buttons the same and that the name IDs.
Rocky Moore www.HintsAndTips.com
"Rocky Moore" <gR*********@hintsandtips.com> wrote in message news:eF**************@tk2msftngp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP**************@TK2MSFTNGP10.phx.gbl... > Well the first problem is the table contains dynamic controls and events in > each row. > > But i have tried only populate on page_load that isn't a post back
and the > table is always empty for me. > > I tried putting my populate table code in the !Page.IsPostBack and
the table > is blank on PostBack.
You say you want it to display the table based on the "data in the button". What data would this be? Can you store that data in your viewstate
and simply post back an ID to that date so that your routine generates the proper table? Is there an example?
Rocky Moore www.HintsAndTips.com
> "Rocky Moore" <gR*********@hintsandtips.com> wrote in message > news:up**************@tk2msftngp13.phx.gbl... > > > > "John Smith Jr." <me@isp.com> wrote in message > > news:e9**************@TK2MSFTNGP09.phx.gbl... > > > I am looking for some way to persist a table web control so when > page_load > > > event comes up, i can display the table as it was. I tried
using > > ViewState > > > with the rows collection but that didn't work to well as I got
an error > > > trying to put rows collection in the viewstate. > > > > > > My problem is this: > > > > > > I load a table with rows and controls, then wire events, this is after > > > clearing the rows of the table initially in this function. > > > > > > When clicking a particular button, I want it to reload the page based on > > > data in this button, problem is, every page load I clear the
table and > > > repopulate it. So the particular button is wiped and a new one created, > I > > > think this is what is causing things to act funky. Is storing
the rows > > > collection as a rows collection (in session. viewstate. or class > variable) > > > my best option? Is there another way? i tried using datagrid
and > > > databinding, but I had problems figuring out how to place
controls in > rows > > > with datagrid, and the table works great up to this point. So I wanted > to > > > get past this hurddle and maybe re-write it into a better contol later. > > > > > > > I am not sure I am getting this correctly, but do you use the !IsPostBack > in > > your Page_Load? If it is an Web control and ViewState is in use
for that > > control, it should keep track of its data all by itself as long as you do > > not recreate it on postbacks. > > > > Rocky Moore > > www.HintsAndTips.com > > > > > > > >
That did it!!
Thanks!
"Eric Veltman" <eric@[RemoveThis]veltman.nu> wrote in message
news:vt************@corp.supernews.com... Hello,
John Smith Jr. wrote:
Since I am using dynamic controls/events, I some how need to keep the
same controls/event wired up, I believe what is happening now is when
Page_load is called, it clears the table, creates new rows and buttons/events,
since these events arnt' the same as the last pass, when the button click
event would normally fire (after page-load) it doesn't cause it no longer
exists (at least the instance that was called, the button still exists as it
was recreated, but it is a "new" button).
You can re-create the dynamically created controls during Page_Load and handle the events, but you have to ensure that the IDs of the dynamically created controls stay the same !
Assign the IDs yourself instead of using automatic ID assignment. With automatic assignment, the ID of the button in the same row will differ when you create it in Page_Load and Button_Click. As a result, ASP.NET can't pass the post data to the right button control.
Best regards,
Eric This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave Veeneman |
last post by:
When does serializing objects make more sense than persisting them to a
database? I'm new to object serialization, and I'm trying to get a feel for
when to use it.
Here is an example: I'm...
|
by: lim |
last post by:
What is the possible error that occurs when the Page_load event is not triggered during execution.
In my page there's some basic server control. Is there any loops holes?
|
by: Diane Yocom |
last post by:
I'm still very new to ASP.Net, so wanted to get some advice on how to solve
the following design problem (sorry my explanation is so long):
I'm developing an ASP.Net intranet app (using VB.Net...
|
by: John Hoge |
last post by:
A common problem in database updates in the maintenece of "domain
tables". For example, a product database has an option for color. When
entering the specifications for a new product, a domain...
|
by: Stu |
last post by:
Hi,
I am creating a control in a PlaceHolder like so:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
Dim ctrl As...
|
by: Dick |
last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls
GridView.DataBind. I want the row that is selected before the DataBind to
still be selected afterwards.
This happens...
|
by: Mad Scientist Jr |
last post by:
my login user control has this public property, passed from the calling
page:
Public TableContent As Table
is this byref? if not how can it be made so?
when the user logs in, the user...
|
by: dougloj |
last post by:
Hi,
In my ASP.NET application, I want to be able to dynamically create
RadioButtonLists and/or
CheckBoxLists according to what is in my database. I wrote routines to
create RadioButtonLists...
|
by: ADezii |
last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
| |