V
Velislav
Hi,
I have the following scenario:
A data-bound repeater, in which every item registers a hidden field
with the item's associated ID (a field pulled out of the database)
using the RegisterHiddenField method in the repeater's OnItemDataBound
event.
I do not re-bind the repeater on post-backs so as not to overwrite the
user input for dynamically created controls in the repeater. Which
means that the hidden fields will not be registered after the first
post back.
Ideally I wouldn't even need more than one postback - client-side
scripts verify input and the user is redirected to a new page when
clicking a button. However, should an exception be thrown at the server
side (eg database unique key violations etc), the user should be able
to correct the issue without having to capture everything again.
I wonder if there is a way to make the hidden fields persist across
post-backs (or alternatively another way to keep track of the repeater
items' associated IDs without displaying them).
I have tried the following, to no avail:
- add a HtmlInputHidden control to the page instead of using
RegisterHiddenField.
- bind the repeater in OnInit instead of Page_Load
Where does the OnItemDataBound even fit in the page's lifecycle?
I have the following scenario:
A data-bound repeater, in which every item registers a hidden field
with the item's associated ID (a field pulled out of the database)
using the RegisterHiddenField method in the repeater's OnItemDataBound
event.
I do not re-bind the repeater on post-backs so as not to overwrite the
user input for dynamically created controls in the repeater. Which
means that the hidden fields will not be registered after the first
post back.
Ideally I wouldn't even need more than one postback - client-side
scripts verify input and the user is redirected to a new page when
clicking a button. However, should an exception be thrown at the server
side (eg database unique key violations etc), the user should be able
to correct the issue without having to capture everything again.
I wonder if there is a way to make the hidden fields persist across
post-backs (or alternatively another way to keep track of the repeater
items' associated IDs without displaying them).
I have tried the following, to no avail:
- add a HtmlInputHidden control to the page instead of using
RegisterHiddenField.
- bind the repeater in OnInit instead of Page_Load
Where does the OnItemDataBound even fit in the page's lifecycle?