> Hi Masudur,
>
> I put some code in the itemCommand event for my repeater, put a
> breakpoint on that code, clicked on the grid when I ran the app and
> nothing happened. What action causes the itemCommand event to be
> executed?
I am not sure what is going on there...
here how it should go...
<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1" OnItemCommand="Repeater1_ItemCommand1">
you put some kind of button or link button .... in itemTemplate or
AlternetingItemTemplete
for example
<ItemTemplate>
<div style="background-color:#cccccc">
<asp:Button ID="btnSelect" Text="Select"
runat="server" CommandName="Select" />
<asp:Label ID="lblName" runat="server" Text=<%#
DataBinder.Eval(Container.DataItem, "Name") %>></asp:Label>
</div>
</ItemTemplate>
as you can see in commandName property of the button i put "Select" As
the command name after that in codebehind file
protected void Repeater1_ItemCommand1(object source,
RepeaterCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//do some code...
}
}
i think i didn't understand what the actual problem is ...
can you be a little bit more descriptive.
Thanks
Masudur
http://munnacs.110mb.com
Doogie - 19 Jun 2007 16:20 GMT
Well, the problem has kind of changed.
Here's an example of what my repeater looks like in html (this is a
partial example for space sake):
<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")%>' />
</ItemTemplate>
</asp:repeater>
This grid is tied to an xsl document. I would like to set this up so
that I can write a method in VB.NET to access the data in this
control. At this point, I don't need a Repeater control event
anymore, I have a button that I've created - outside of the control -
that will have code behind it to do the work I need.
But I need to know what the data is inside the control. The Repeater
control appears to have no properties/methods, etc of any kind that
will show me what data is inside of it as far as I can tell. So I
can't figure out how to "read my data".
I am thinking that somehow I need to read the xsl but am not sure
there either. At this point, I am not sure what the best approach is
to accomplish this.
Masudur - 20 Jun 2007 11:48 GMT
> Well, the problem has kind of changed.
>
[quoted text clipped - 24 lines]
> there either. At this point, I am not sure what the best approach is
> to accomplish this.
hi...
First can you please make sure that your View state persists... by
enableViewState = true...
foreach(RepeaterItem item in Repeater1.Items)
{
if (item.ItemType == ListItemType.AlternatingItem ||
item.ItemType == ListItemType.Item)
{
Label lbl = (Label)item.FindControl("lblName");
if (lbl != null)
{
string Name = lbl.Text.Trim();
}
}
}
Thanks
Masudur
www.kaz.com.bd
http://munnacs.110mb.com
Doogie - 20 Jun 2007 13:28 GMT
Hi Masudur,
I found a way around my issue. It wasn't exactly what I planned on
doing, I stored the data I needed to access from the repeater grid
inside a hidden control and used that to do what I need. Since I
won't ever be using much data at any given time, this seems to work
well (and gets me around a problem that has been taking days to figure
out!)