Adding ImageButton into Datalist

Discussion in 'ASP .Net' started by =?Utf-8?B?SnVuaW9yUHJvZ3JhbW1lcg==?=, Mar 20, 2006.

  1. 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
     
    =?Utf-8?B?SnVuaW9yUHJvZ3JhbW1lcg==?=, Mar 20, 2006
    #1
    1. Advertising

  2. 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
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Mar 21, 2006
    #2
    1. Advertising

  3. 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
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Mar 21, 2006
    #3
  4. 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
     
    =?Utf-8?B?SnVuaW9yUHJvZ3JhbW1lcg==?=, Mar 21, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nevyn Twyll
    Replies:
    8
    Views:
    1,966
  2. =?Utf-8?B?aG4=?=

    ImageButton in datalist doesn't capture event

    =?Utf-8?B?aG4=?=, Nov 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,973
    =?Utf-8?B?aG4=?=
    Nov 29, 2004
  3. John Stemper

    ImageButton server control in a Datalist Prob.

    John Stemper, Jul 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    191
    Yan-Hong Huang[MSFT]
    Jul 4, 2003
  4. Travis

    DataList ImageButton Problems

    Travis, Jul 9, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    203
    Travis
    Jul 9, 2003
  5. J 2 the B

    Responding to Imagebutton click in DataList

    J 2 the B, Jul 24, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    287
    Ravikanth[MVP]
    Jul 25, 2003
Loading...

Share This Page