Can't get Repeater control to work the way I need it to

D

Doogie

Hi, I have been trying to get a checkbox added to a repeater control
of mine and then try to access events of the repeater control when a
user clicks the checkbox. At first, since the control is tied to xsl,
I added the checkbox there. That works fine, but I cannot get any
information about the checkbox (i.e. checked, unchecked, etc) when I
pass data from the xsl over to a method in java. I can get info on
the other columns but not that one.

So I thought maybe it was because the repeater control's html doesn't
have the checkbox identified in it. Below is how the repeater control
looks:

<asp:repeater ID="RptTrip" Runat="server" EnableViewState="false">
<ItemTemplate>
<trip_detail_info trip_detail_id ='<%#
Container.DataItem("trip_detail_id")%>'
leg_start_dt = '<%#
Container.DataItem("leg_start_dt")%>'
pickup_iso_dt = '<%#
Container.DataItem("pickup_iso_dt")%>'
trip_status = '<%#
Container.DataItem("trip_status")%>'
eqp_type = '<%#
filterPostrophe(Container.DataItem("eqp_type"))%>'
expire_iso_dt = '<%#
Container.DataItem("expire_iso_dt")%>'
dispatch_dt = '<%#
Container.DataItem("dispatch_dt")%>'
dispatch_iso_dt = '<%#
Container.DataItem("dispatch_iso_dt")%>'
trip_status_update_dt = '<%#
Container.DataItem("trip_status_update_dt")%>'
status_iso_dt = '<%#
Container.DataItem("status_iso_dt")%>'
haz = '<%# Container.DataItem("haz")
%>'
leg_type_ds = '<%#
Container.DataItem("leg_type_ds")%>'
move_type_ds = '<%#
Container.DataItem("move_type_ds")%>'
cont_reefer = '<%#
Container.DataItem("cont_reefer")%>'
trip_bkg_nr = '<%#
Container.DataItem("trip_bkg_nr")%>'
container_an = '<%#
Container.DataItem("container_an")%>'
orig_customer_nm = '<%#
filterPostrophe(Container.DataItem("orig_customer_nm"))%>'
dest_customer_nm = '<%#
filterPostrophe(Container.DataItem("dest_customer_nm"))%>'
orig_loc_nm = '<%#
filterPostrophe(Container.DataItem("orig_loc_nm"))%>'
dest_loc_nm = '<%#
filterPostrophe(Container.DataItem("dest_loc_nm"))%>'/>
</ItemTemplate>
</asp:repeater>


So I tried to add a checkbox like so:


<asp:repeater ID="RptTrip" Runat="server" EnableViewState="false">
<ItemTemplate>
<td><asp:CheckBox ID="cb" Runat="server" Checked="true"
Enabled="true"></asp:CheckBox> </td>
<trip_detail_info trip_detail_id ='<%#
Container.DataItem("trip_detail_id")%>'
leg_start_dt = '<%#
Container.DataItem("leg_start_dt")%>'
pickup_iso_dt = '<%#
Container.DataItem("pickup_iso_dt")%>'
trip_status = '<%#
Container.DataItem("trip_status")%>'
eqp_type = '<%#
filterPostrophe(Container.DataItem("eqp_type"))%>'
expire_iso_dt = '<%#
Container.DataItem("expire_iso_dt")%>'
dispatch_dt = '<%#
Container.DataItem("dispatch_dt")%>'
dispatch_iso_dt = '<%#
Container.DataItem("dispatch_iso_dt")%>'
trip_status_update_dt = '<%#
Container.DataItem("trip_status_update_dt")%>'
status_iso_dt = '<%#
Container.DataItem("status_iso_dt")%>'
haz = '<%# Container.DataItem("haz")
%>'
leg_type_ds = '<%#
Container.DataItem("leg_type_ds")%>'
move_type_ds = '<%#
Container.DataItem("move_type_ds")%>'
cont_reefer = '<%#
Container.DataItem("cont_reefer")%>'
trip_bkg_nr = '<%#
Container.DataItem("trip_bkg_nr")%>'
container_an = '<%#
Container.DataItem("container_an")%>'
orig_customer_nm = '<%#
filterPostrophe(Container.DataItem("orig_customer_nm"))%>'
dest_customer_nm = '<%#
filterPostrophe(Container.DataItem("dest_customer_nm"))%>'
orig_loc_nm = '<%#
filterPostrophe(Container.DataItem("orig_loc_nm"))%>'
dest_loc_nm = '<%#
filterPostrophe(Container.DataItem("dest_loc_nm"))%>'/>
</ItemTemplate>
</asp:repeater>

For some reason, it is not recognizing that checkbox and displaying it
on the screen. I've tried it with and without the <td> lines.

In addition, I can't go the route of checking this information within
the vb code because none of the Repeater's events will execute when I
click on the grid in the app. I've tried itemCommand as suggested by
someone but it doesn't execute when I click the grid.

I'm half-tempted to use a different control, but this control is tied
to a lot of xsl, javascript, vb code already in the app so that would
be a lot of work to do.

Can anyone see what I'm doing wrong?
 
J

Josh

There does not appear to be any default behaviour in a check box thats going
to do what you want.

You could create a hack of some sort such as a piece of javascript
tosecretly click a hidden button thats in the repeater row. But thats a
real hash.

Another alternative which is slightly better is to use an ImageButton that
"looks" like check box and displays either a ticked on unticked image.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top