By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,617 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,617 IT Pros & Developers. It's quick & easy.

Adding ImageButton into Datalist

P: n/a
Am trying to add an Image Button into a Datalist at Design time.

When I run it it comes up with error: Server tag not well formed.

It works perfectly when I add just an Image Control. Please help.

<asp:DataList
id="dlstframes"
runat="server">
<ItemTemplate>
<asp:ImageButton runat="server"
ImageUrl="<%# Container.DataItem("pictues") %>" />
</ItemTemplate>
</aspataList>

Please do help. I have serched thru the net to find something to solve this
problem. But cant find any clue.
--
Iyke
Mar 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You probably have figured out by now that you have typo in the syntax. You
needed to use single quotes to enclose the data binding expression because
the latter contains double quotation marks.

<asp:ImageButton runat="server"
ImageUrl='<%# Container.DataItem("pictues") %>' />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"JuniorProgrammer" wrote:
Am trying to add an Image Button into a Datalist at Design time.

When I run it it comes up with error: Server tag not well formed.

It works perfectly when I add just an Image Control. Please help.

<asp:DataList
id="dlstframes"
runat="server">
<ItemTemplate>
<asp:ImageButton runat="server"
ImageUrl="<%# Container.DataItem("pictues") %>" />
</ItemTemplate>
</aspataList>

Please do help. I have serched thru the net to find something to solve this
problem. But cant find any clue.
--
Iyke

Mar 21 '06 #2

P: n/a
I also missed correcting the syntax for databinding which should have been:
<asp:ImageButton runat="server" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "picturename") %>' />

"Phillip Williams" wrote:
You probably have figured out by now that you have typo in the syntax. You
needed to use single quotes to enclose the data binding expression because
the latter contains double quotation marks.

<asp:ImageButton runat="server"
ImageUrl='<%# Container.DataItem("pictues") %>' />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"JuniorProgrammer" wrote:
Am trying to add an Image Button into a Datalist at Design time.

When I run it it comes up with error: Server tag not well formed.

It works perfectly when I add just an Image Control. Please help.

<asp:DataList
id="dlstframes"
runat="server">
<ItemTemplate>
<asp:ImageButton runat="server"
ImageUrl="<%# Container.DataItem("pictues") %>" />
</ItemTemplate>
</aspataList>

Please do help. I have serched thru the net to find something to solve this
problem. But cant find any clue.
--
Iyke

Mar 21 '06 #3

P: n/a
I have tried changing the " to ' and have used DataBinder .Eval and now it
comes up with the error message

Control 'dlstProducts__ctl0__ctl0' of type 'ImageButton' must be placed
inside a form tag with runat=server.

But when I close the <asp:ImageButton with </asp:ImageButton> it still comes
up with error

Server tag not well formed.

Is this a problem with my compiler or something. It works perfectly with the
ordinary image control but not with the ImageButton control.

I really want to know what the problem is comeone help.
--
Iyke
"Phillip Williams" wrote:
I also missed correcting the syntax for databinding which should have been:
<asp:ImageButton runat="server" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "picturename") %>' />

"Phillip Williams" wrote:
You probably have figured out by now that you have typo in the syntax. You
needed to use single quotes to enclose the data binding expression because
the latter contains double quotation marks.

<asp:ImageButton runat="server"
ImageUrl='<%# Container.DataItem("pictues") %>' />

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"JuniorProgrammer" wrote:
Am trying to add an Image Button into a Datalist at Design time.

When I run it it comes up with error: Server tag not well formed.

It works perfectly when I add just an Image Control. Please help.

<asp:DataList
id="dlstframes"
runat="server">
<ItemTemplate>
<asp:ImageButton runat="server"
ImageUrl="<%# Container.DataItem("pictues") %>" />
</ItemTemplate>
</aspataList>

Please do help. I have serched thru the net to find something to solve this
problem. But cant find any clue.
--
Iyke

Mar 21 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.