H
Hartmut Schroth
Hi,
I need a solution for the following problem:
In the item template of a datalist control I have already
a button control with the commandname set to "select" to
perform some specific database action. I additionally want
to update an integer value in the underlying data source
by simply clicking an a check box or an imagebutton
WITHOUT USING THE EDIT/UPDATE COMMANDNAME property of the
datalist. So for example the datasource should be updated,
whenever the checkbox checked-property changes.
I tried two methods without success:
(1) If I use the OnCheckedChanged-event and set the
autopostback property to true, I cannot access the
SelectedIndex of the datalist in the event handler. But
this is the primary key of the datasource and is necesary
for the update. Accessing other objects of the item
template (e.g. a textbox which holds the primary key) is
not possible as well.
(2) I tried to use a second imagebutton instead of the
checkbox and set the commandname of the imagebutton
to "select" as well. Then everything is OK
with the SelectedIndex, but how can I determine, which of
the two different "Select" buttons has been clicked? I
need to know which one, because I have to perform
different tasks.
Thanks in advance.
Regards
Hartmut
I need a solution for the following problem:
In the item template of a datalist control I have already
a button control with the commandname set to "select" to
perform some specific database action. I additionally want
to update an integer value in the underlying data source
by simply clicking an a check box or an imagebutton
WITHOUT USING THE EDIT/UPDATE COMMANDNAME property of the
datalist. So for example the datasource should be updated,
whenever the checkbox checked-property changes.
I tried two methods without success:
(1) If I use the OnCheckedChanged-event and set the
autopostback property to true, I cannot access the
SelectedIndex of the datalist in the event handler. But
this is the primary key of the datasource and is necesary
for the update. Accessing other objects of the item
template (e.g. a textbox which holds the primary key) is
not possible as well.
(2) I tried to use a second imagebutton instead of the
checkbox and set the commandname of the imagebutton
to "select" as well. Then everything is OK
with the SelectedIndex, but how can I determine, which of
the two different "Select" buttons has been clicked? I
need to know which one, because I have to perform
different tasks.
Thanks in advance.
Regards
Hartmut