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 1826
"John Smith Jr." <me@isp.com> wrote in message
news:e9******** ******@TK2MSFTN GP09.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.IsPostBac k and the table
is blank on PostBack.
"Rocky Moore" <gR*********@hi ntsandtips.com> wrote in message
news:up******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP10.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.IsPostBac k 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*********@hi ntsandtips.com> wrote in message news:up******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9******** ******@TK2MSFTN GP09.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.Attribut e[""]
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*********@hi ntsandtips.com> wrote in message
news:eF******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP******** ******@TK2MSFTN GP10.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.IsPostBac k 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*********@hi ntsandtips.com> wrote in message news:up******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:e9******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP11.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.Attribut e[""] 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*********@hi ntsandtips.com> wrote in message news:eF******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP******** ******@TK2MSFTN GP10.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.IsPostBac k 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*********@hi ntsandtips.com> wrote in message news:up******** ******@tk2msftn gp13.phx.gbl... > > "John Smith Jr." <me@isp.com> wrote in message > news:e9******** ******@TK2MSFTN GP09.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*********@hi ntsandtips.com> wrote in message
news:O3******** ******@TK2MSFTN GP12.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:uI******** ******@TK2MSFTN GP11.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.Attribut e[""] 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*********@hi ntsandtips.com> wrote in message news:eF******** ******@tk2msftn gp13.phx.gbl... "John Smith Jr." <me@isp.com> wrote in message news:eP******** ******@TK2MSFTN GP10.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.IsPostBac k 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*********@hi ntsandtips.com> wrote in message > news:up******** ******@tk2msftn gp13.phx.gbl... > > > > "John Smith Jr." <me@isp.com> wrote in message > > news:e9******** ******@TK2MSFTN GP09.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.super news.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 writing an accounting application. I have a chart of
accounts in the form of a containment hierarchy. A GeneralLedger contains a
number of Accounts, and each of these Accounts can contain a Aubledger,
which contains its own Accounts, and so on. The...
|
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 for my business
objects) that will allow my users (max of about 25) to enter information
about families and their children. On one page, I need to collect general
information about the family (such as address and phone number) and specific...
|
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 table is used
to populate a drop down list of available colors.
Simple so far. But what if the user wants to create a new color
specification on the fly? Let's say that this is a complicated process
requiring it's own page with validation code....
|
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 AcceptOrCancel =
CType(Page.LoadControl("controls/AcceptOrCancel.ascx"), AcceptOrCancel)
PlaceHolder1.Controls.Add(ctrl)
| |
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 automatically if the data doesn't change. But if records have
been added or deleted then it looks as if some code is necessary: I've done
this by using GridView.SelectedValue to get the key value of the currently
selected Row and then by itterating...
|
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 control calls a content object to show
or hide rows in TableContent
|
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 and CheckBoxLists. Each routine pulls data out
of my database, populates the respective control, and passes the
control back to the caller. The caller places the returned controls
into a table. The controls are displayed as expected.
|
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 specific moment in time - then gone the next. Few of us realize, however, that they can be saved to disk and later retrieved to will. The technical jargon for this is called 'Persisting a Recordset' and I'll show you how it can be done. ADO has this...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |