HighTechTalks DotNet Forums  

Repeater OnItemCommand

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Repeater OnItemCommand in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Peter
 
Posts: n/a

Default Repeater OnItemCommand - 10-23-2008 , 10:22 AM






Hi,

I have an <asp:Repeater> on my page. In the repeater I have
LinkButtons, which when clicked cause an "OnItemCommand" method to be
called.

In my "OnItemCommand" method, I notice that the e.Item.DataItem
property is null. Is this normal? Is it possible to have this property
return the original DataItem which has used when popultaing the
Repeater control? (I can see that the DataItem is set as I expected on
OnItemDataBound, but not in the OnItemCommand).

Thanks,
Peter

--


Reply With Quote
  #2  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-23-2008 , 07:32 PM






In what event do you do the call the DataBind() method?
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I have an <asp:Repeater> on my page. In the repeater I have
LinkButtons, which when clicked cause an "OnItemCommand" method to be
called.

In my "OnItemCommand" method, I notice that the e.Item.DataItem
property is null. Is this normal? Is it possible to have this property
return the original DataItem which has used when popultaing the
Repeater control? (I can see that the DataItem is set as I expected on
OnItemDataBound, but not in the OnItemCommand).

Thanks,
Peter

--




Reply With Quote
  #3  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-23-2008 , 07:32 PM



In what event do you do the call the DataBind() method?
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I have an <asp:Repeater> on my page. In the repeater I have
LinkButtons, which when clicked cause an "OnItemCommand" method to be
called.

In my "OnItemCommand" method, I notice that the e.Item.DataItem
property is null. Is this normal? Is it possible to have this property
return the original DataItem which has used when popultaing the
Repeater control? (I can see that the DataItem is set as I expected on
OnItemDataBound, but not in the OnItemCommand).

Thanks,
Peter

--




Reply With Quote
  #4  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-23-2008 , 07:32 PM



In what event do you do the call the DataBind() method?
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Hi,

I have an <asp:Repeater> on my page. In the repeater I have
LinkButtons, which when clicked cause an "OnItemCommand" method to be
called.

In my "OnItemCommand" method, I notice that the e.Item.DataItem
property is null. Is this normal? Is it possible to have this property
return the original DataItem which has used when popultaing the
Repeater control? (I can see that the DataItem is set as I expected on
OnItemDataBound, but not in the OnItemCommand).

Thanks,
Peter

--




Reply With Quote
  #5  
Old   
Peter
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 02:23 AM



Nathan Sokalski wrote:

Quote:
In what event do you do the call the DataBind() method?
I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter


Reply With Quote
  #6  
Old   
Peter
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 02:23 AM



Nathan Sokalski wrote:

Quote:
In what event do you do the call the DataBind() method?
I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter


Reply With Quote
  #7  
Old   
Peter
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 02:23 AM



Nathan Sokalski wrote:

Quote:
In what event do you do the call the DataBind() method?
I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter


Reply With Quote
  #8  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 04:07 PM



The DataItem property is not available in the ItemCommand event, it is
simply there because it is a property of Item. I normally recommend using
e.CommandArgument in ItemCommand.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Nathan Sokalski wrote:

In what event do you do the call the DataBind() method?

I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter



Reply With Quote
  #9  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 04:07 PM



The DataItem property is not available in the ItemCommand event, it is
simply there because it is a property of Item. I normally recommend using
e.CommandArgument in ItemCommand.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Nathan Sokalski wrote:

In what event do you do the call the DataBind() method?

I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter



Reply With Quote
  #10  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Repeater OnItemCommand - 10-24-2008 , 04:07 PM



The DataItem property is not available in the ItemCommand event, it is
simply there because it is a property of Item. I normally recommend using
e.CommandArgument in ItemCommand.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter" <xdzgor (AT) hotmail (DOT) com> wrote

Quote:
Nathan Sokalski wrote:

In what event do you do the call the DataBind() method?

I call it from within Page_Load.

From Page_Load I fetch some data from a "data access" class which I set
as the DataSource for the repeater, and then I call DataBind.

If I have a "ItemDataBound" method, I can see the individual DataItem
objects, but I can not see them when the "ItemCommand" method is called.

Thanks,
Peter



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.