On the page_load event I am querying a database and binding data to some
text boxes, list boxes, and a repeater control. When the page loads it uses
the value of one of the database fields (status) to determine what options
should be available for this particular item (which is an issue... small
issue tracking system). Each of these options is an action that may be
performed on the issue and I am dynamically creating LinkButtons for each
available action. So, based on current status, I add LinkButton controls to
a panel. Each of these LinkButton controls has the same addHandler sub
routine which will perform the action based on the commandName. Thats the
basic setup I'm trying to acheive. I am in the middle of doing this and
realized a potential problem:
1) I have added the LinkButtons to the panel with no problem BUT I noticed
when clicking on one ALL of them disappear. I have not written the sub
routine for the addHandler for these linkButtons but the fact that they
disappeared upon clicking them raised some concerns. What gives? I mean, I
am kind of not suprised since these were created dynamically but I guess I
thought that viewstate would persist them through the postback. no? Maybe I
need to explicitly set them to persist through the postback?
2) If the LinkButtons disappear on postback will their command event fire?
Plus, I can't have them disappear... can I prevent that or do I have to
somehow add them again?
3) Do linkButtons always do a postback?
4) I guess this is probably a dumb question to those not new to asp.net but
here goes:
First an example of what I need to acheive. One of the link buttons will
enable a field to be updated. For example it will say "Update ETA" and upon
clicking it a textbox that currently contains the current ETA field data
will change its border, background color, and readOnly property to show that
you may now edit the data. And an update button will also be added below to
actually perform the update in the database. Thats the example. So heres the
dumb question: Is a postback required for that to happen? I am first
clicking on a button control (that was dynamically created on page load)
that needs to change the properties of another control and dynamically add
another button control. Then that button control performs the db update.
sorry for such a long winded post. I will be working on this again tomorrow
and just wanted to empty my questions out here and sleep on it.
any input is appreciated.
thanks. 2 1931
If you are creating the controls dynamically, you are responsible for
recreating them after the postback.
Denis Bauer has a free Placeholder control (with source code) that handles
the chore for you: http://www.denisbauer.com/ASPNETCont...aceholder.aspx
Ken
Another
"djc" <dc*********@megapathdsl.net> wrote in message
news:O3**************@TK2MSFTNGP12.phx.gbl... On the page_load event I am querying a database and binding data to some text boxes, list boxes, and a repeater control. When the page loads it uses the value of one of the database fields (status) to determine what options should be available for this particular item (which is an issue... small issue tracking system). Each of these options is an action that may be performed on the issue and I am dynamically creating LinkButtons for each available action. So, based on current status, I add LinkButton controls to a panel. Each of these LinkButton controls has the same addHandler sub routine which will perform the action based on the commandName. Thats the basic setup I'm trying to acheive. I am in the middle of doing this and realized a potential problem:
1) I have added the LinkButtons to the panel with no problem BUT I noticed when clicking on one ALL of them disappear. I have not written the sub routine for the addHandler for these linkButtons but the fact that they disappeared upon clicking them raised some concerns. What gives? I mean, I am kind of not suprised since these were created dynamically but I guess I thought that viewstate would persist them through the postback. no? Maybe I need to explicitly set them to persist through the postback?
2) If the LinkButtons disappear on postback will their command event fire? Plus, I can't have them disappear... can I prevent that or do I have to somehow add them again?
3) Do linkButtons always do a postback?
4) I guess this is probably a dumb question to those not new to asp.net but here goes: First an example of what I need to acheive. One of the link buttons will enable a field to be updated. For example it will say "Update ETA" and upon clicking it a textbox that currently contains the current ETA field data will change its border, background color, and readOnly property to show that you may now edit the data. And an update button will also be added below to actually perform the update in the database. Thats the example. So heres the dumb question: Is a postback required for that to happen? I am first clicking on a button control (that was dynamically created on page load) that needs to change the properties of another control and dynamically add another button control. Then that button control performs the db update.
sorry for such a long winded post. I will be working on this again tomorrow and just wanted to empty my questions out here and sleep on it.
any input is appreciated. thanks.
thanks for the input. I'll check out the link.
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl... If you are creating the controls dynamically, you are responsible for recreating them after the postback.
Denis Bauer has a free Placeholder control (with source code) that handles the chore for you:
http://www.denisbauer.com/ASPNETCont...aceholder.aspx
Ken
Another "djc" <dc*********@megapathdsl.net> wrote in message news:O3**************@TK2MSFTNGP12.phx.gbl... On the page_load event I am querying a database and binding data to some text boxes, list boxes, and a repeater control. When the page loads it uses the value of one of the database fields (status) to determine what
options should be available for this particular item (which is an issue... small issue tracking system). Each of these options is an action that may be performed on the issue and I am dynamically creating LinkButtons for
each available action. So, based on current status, I add LinkButton controls to a panel. Each of these LinkButton controls has the same addHandler sub routine which will perform the action based on the commandName. Thats
the basic setup I'm trying to acheive. I am in the middle of doing this and realized a potential problem:
1) I have added the LinkButtons to the panel with no problem BUT I
noticed when clicking on one ALL of them disappear. I have not written the sub routine for the addHandler for these linkButtons but the fact that they disappeared upon clicking them raised some concerns. What gives? I mean,
I am kind of not suprised since these were created dynamically but I guess
I thought that viewstate would persist them through the postback. no?
Maybe I need to explicitly set them to persist through the postback?
2) If the LinkButtons disappear on postback will their command event
fire? Plus, I can't have them disappear... can I prevent that or do I have to somehow add them again?
3) Do linkButtons always do a postback?
4) I guess this is probably a dumb question to those not new to asp.net but here goes: First an example of what I need to acheive. One of the link buttons will enable a field to be updated. For example it will say "Update ETA" and upon clicking it a textbox that currently contains the current ETA field data will change its border, background color, and readOnly property to show that you may now edit the data. And an update button will also be added below to actually perform the update in the database. Thats the example. So heres the dumb question: Is a postback required for that to happen? I am first clicking on a button control (that was dynamically created on page load) that needs to change the properties of another control and dynamically
add another button control. Then that button control performs the db update.
sorry for such a long winded post. I will be working on this again tomorrow and just wanted to empty my questions out here and sleep on it.
any input is appreciated. thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RussC |
last post by:
My C# app has a toolbar with 12 or so buttons on it, all created via the
designer. In some circumstances we need to add one or two buttons to it
dynamically. I have code that does this and it...
|
by: Gopal Krish |
last post by:
I'm have coded a simple menu (using link buttons as menu items) in a
user control to be reused across many ASPX pages.
In the page_load method I dynamically create the link buttons as
follows
...
|
by: AndrewMBaldwin |
last post by:
Ok, this is going to be a long post, so I apologize in advance, but if
it was an easy question I would have probably found an answer somewhere
out here by now...
The short story of this is that...
|
by: Mark |
last post by:
Assume you want to dynamically add one to many link button controls to a web
page dynamically at run time. Each link button needs to post back and
execute code. As the link buttons are created at...
|
by: =?Utf-8?B?TWlrZSBSYW5k?= |
last post by:
I have created a method that dynamically creates a single button control (as
a proof-of-concept, I would like to be able to create multiple buttons). I
set properties on this control including an...
| |
by: Amoril |
last post by:
I've read quite a few different message on various boards and for some
reason I'm still having trouble wrapping my head around this viewstate
maintenance and trying to get these dynamically created...
|
by: Radu |
last post by:
Hi. I have a page with the following html:
__________________________________________________________
<h1>Dynamic Controls Test</h1>
<hr />
<asp:TextBox ID="txtProduct1" Text="txtProduct 1"...
|
by: johnjsforum |
last post by:
Buddies,
I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function
////////////////////////////////////////////////////////////////////////////////////...
|
by: semomaniz |
last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
|
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,...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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: 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 ...
| |
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...
| |