G
Guest
I am confused about the way in which asp:table objects work. When a control
is within an asp table it generally appears to be in the scope of the tables
parent control. E.g. if i have a page that consists of an asp table called
MyTable containing a textbox control call MyTextBox then i can access
MyTextBox directly from the PageLoad event handler without having to use
MyTable.FindControl(MyTextBox). MyTextBox can also be used for a control
paramter for an DataSourcecontrol that is outside of MyTable. In short ASP
table objects do not seem to impose the same kind of scoping restriction that
apply to data bound control such as DetalsView or GridvView.
However i have found that if you use an asp table object within a
TemplateField then place a control, that has been bound using <%#
Bind("FieldName") %> syntax, within that table, the two way databinding does
not work. It works as far as retreiving that data is concerned but as suu as
you try to insert or update data it treats all the values as null. If you
move the data bound controls outside tha asp table then updating and
inserting work fine. Deleting works fine even within the table.
I have got round this by using the ItemUpdating and ItemInserting event
handlers and pulling tha value out of the controls within the table and
putting them in e.NewValue and e.Values respectively.
What am i missing, why does two way databinding not work within an asp table
object.
is within an asp table it generally appears to be in the scope of the tables
parent control. E.g. if i have a page that consists of an asp table called
MyTable containing a textbox control call MyTextBox then i can access
MyTextBox directly from the PageLoad event handler without having to use
MyTable.FindControl(MyTextBox). MyTextBox can also be used for a control
paramter for an DataSourcecontrol that is outside of MyTable. In short ASP
table objects do not seem to impose the same kind of scoping restriction that
apply to data bound control such as DetalsView or GridvView.
However i have found that if you use an asp table object within a
TemplateField then place a control, that has been bound using <%#
Bind("FieldName") %> syntax, within that table, the two way databinding does
not work. It works as far as retreiving that data is concerned but as suu as
you try to insert or update data it treats all the values as null. If you
move the data bound controls outside tha asp table then updating and
inserting work fine. Deleting works fine even within the table.
I have got round this by using the ItemUpdating and ItemInserting event
handlers and pulling tha value out of the controls within the table and
putting them in e.NewValue and e.Values respectively.
What am i missing, why does two way databinding not work within an asp table
object.