Databinding Syntax Not Working in ListView LayoutTemplate

R

Roshawn

Hi,

Working with the new ListView control seems pretty straightforward. For some reason,
using ASP.NET's databinding syntax (i.e. <%# DataHere %>) in the control's layouttemplate
doesn't work. Is there any way of making it work? If not, is it possible to create a
derived control that enables this functionality?

Thanks,
Roshawn
 
S

Stan

Hi,

Working with the new ListView control seems pretty straightforward.  Forsome reason,
using ASP.NET's databinding syntax (i.e. <%# DataHere %>) in the control'slayouttemplate
doesn't work.  Is there any way of making it work?  If not, is it possible to create a
derived control that enables this functionality?

Thanks,
Roshawn

You have to include the Eval("<column name>") or the Bind("<column
name>") function within the '<%# ... %> ' to actually retrieve or
ammend any data.

HTH
 
R

Roshawn

Thanks for the response. Unfortunately, even this doesn't work. From what I've read,
it's not possible to bind to anything within the ListView's layouttemplate. It's strange
that I can do so in a master page and pretty much anywhere else except here.

I'm open to any more suggestions.

Thanks,
 
S

Stan

Thanks for the response.  Unfortunately, even this doesn't work.  Fromwhat I've read,
it's not possible to bind to anything within the ListView's layouttemplate..  It's strange
that I can do so in a master page and pretty much anywhere else except here.

I'm open to any more suggestions.

Thanks,






- Show quoted text -

Ahh! Sorry I misunderstood.

The answer to your question is probably no. The LayoutTemplate is
purely to define the overall structure and appearence of the control
not to render any actual data. All databound elements have to go in
the ItemTemplate, AlternatingItemtemplate etc

If you tell us a bit more about what you are trying to do it may be
possible to suggest alternatives.
 
W

Wallace Breza

You can subscribe to the "LayoutCreated" event within the
ListView control. Within the event handler, cast the
sender to the ListView, perform a FindControl(id) for the
control within the LayoutTemplate that you want to
manipulate and programatically databind your control(s).
 

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

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top