467,102 Members | 1,130 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,102 developers. It's quick & easy.

Data binding with a repeater

I'm having a problem getting the data binding to work with the repeater control. Here's the code for the code-behind class

private void Page_Load(object sender, System.EventArgs e

if (!this.IsPostBack

DataView dv = new DataView(AlbumMgr.Instance.GetAlbumsList())

rptalbums.DataSource = dv
rptalbums.DataBind()

Here's the script for the repeater

<asp:Repeater id="rptalbums" runat="server"><ItemTemplate><tr><td class="alternate" width="*"><a href="#" onclick='SelectAlbum(<%# DataBinder.Eval(Container.DataItem, "AlbumKey");%>); return false;' target="frmmain"><%# DataBinder.Eval(Container.DataItem, "Title");%></a></td><td class="alternate" width="16px"><a href="#" onclick='RemoveAlbum(<%# DataBinder.Eval(Container.DataItem, "AlbumKey");%>); return false;'><img border="0" src="images/trash.gif" /></a></td></tr></ItemTemplate><AlternatingItemTemplate><tr><td class="alternate" width="*"><a href="#" onclick='SelectAlbum(<%# DataBinder.Eval(Container.DataItem, "AlbumKey");%>); return false;' target="frmmain"><%# DataBinder.Eval(Container.DataItem, "Title");%></a></td><td class="alternate" width="16px"><a href="#" onclick='RemoveAlbum(<%# DataBinder.Eval(Container.DataItem, "AlbumKey");%>); return false;'><img border="0" src="images/trash.gif" /></a></td></tr></AlternatingItemTemplate><--snip--

No matter what I try, I always get error "CS1026: ) expected"

Could anyone point out what I am doing wrong?
Nov 18 '05 #1
  • viewed: 1816
Share:
2 Replies
"Paul K" <an*******@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I'm having a problem getting the data binding to work with the repeater control. Here's the code for the code-behind class:
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
DataView dv = new DataView(AlbumMgr.Instance.GetAlbumsList());

rptalbums.DataSource = dv;
rptalbums.DataBind();
}
}

Here's the script for the repeater: ....
No matter what I try, I always get error "CS1026: ) expected".

Could anyone point out what I am doing wrong?


Yes. You're not simplifying the problem.

This is a case where you should use what I call "binary destroy" (like
binary search, but more violent). Delete half of your ItemTemplate. See if
you still have the problem. If so, delete half of what remains and try
again. If not, put back what you deleted and delete half of it and try
again. You'll eventually find something you can remove and have things work,
or add back and have them fail. That's the culprit...
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Not sure what the problem is yet, but I tried creating a new page with just a few things on it (including a repeater). It works like it should. However, on the old page with the same code it didn't work. Unfortunately, this is the second time I have had a problem with VS.NET (the first time was an extreme slow-down with a winforms app whenever a window was painted -- had to re-create the form to fix the problem)

If I find the problem I'll make sure to post what it is.
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dot net work | last post: by
3 posts views Thread by Joel Daniels | last post: by
4 posts views Thread by Joel | last post: by
3 posts views Thread by Alex Maghen | last post: by
4 posts views Thread by Brad Baker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.