ViewState Data Repeater

C

Craig

Hi

I am binding to a Repeater web control with an array. The data is displayed
in a LinkButton so that I can access the 'clicked' item through the
repeaters ItemCommand event.

Even though I have set the ViewState = true in the control designer, it
doesn't appear to be worling, I was expecting to get access to my class
(that was binded to the repeater DataSource) e.Item.ItemData instead I get
<undefined>.

If the page is not doing a post back why would the ItemCreated event fire
again?

Craig
 
T

Teemu Keiski

Hi,

e.Item.DataItem is not accessible in ItemCommand on postback. DataItem is
there only after DataBind is called (from that point on to the end of the
request). In another words, complete dataitem is not stored to ViewState as
it would make the data to be roundtripped way too massive.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


Hi

I am binding to a Repeater web control with an array. The data is displayed
in a LinkButton so that I can access the 'clicked' item through the
repeaters ItemCommand event.

Even though I have set the ViewState = true in the control designer, it
doesn't appear to be worling, I was expecting to get access to my class
(that was binded to the repeater DataSource) e.Item.ItemData instead I get
<undefined>.

If the page is not doing a post back why would the ItemCreated event fire
again?

Craig
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top