CommandArgument for a LinkButton in a repeater (.net 1.1)

Discussion in 'ASP .Net' started by MattB, Jan 24, 2008.

  1. MattB

    MattB Guest

    I'm trying to put a Link button in the ItemTemplate of a repeater. I've
    created/wired the handler event, and I'm just trying to make the
    LinkButton pass what I need to that event. I thought I had it right, but
    I get a parser error when running this page. LinkButton looks like this:

    <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    CommandArgument='<%# DataBinder.Eval(Container.DataItem,
    "id"%>')>Remove</asp:LinkButton>

    I'm pretty sure there is a problem with the CommandArgument part but I
    can't figure out what it is. I've been trying different uses of single
    and double quotes thinking maybe that was it but it still hasn't started
    working. Can anyone see what I did wrong there? Thanks!

    Matt
    MattB, Jan 24, 2008
    #1
    1. Advertising

  2. MattB

    Guest

    I believe there is a syntax error. Try this instead:

    <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    CommandArgument='<%# DataBinder.Eval(Container.DataItem,"id")
    %>'>Remove</asp:LinkButton>


    On Jan 24, 2:53 pm, MattB <> wrote:
    > I'm trying to put a Link button in the ItemTemplate of a repeater. I've
    > created/wired the handler event, and I'm just trying to make the
    > LinkButton pass what I need to that event. I thought I had it right, but
    > I get a parser error when running this page. LinkButton looks like this:
    >
    > <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    > CommandArgument='<%# DataBinder.Eval(Container.DataItem,
    > "id"%>')>Remove</asp:LinkButton>
    >
    > I'm pretty sure there is a problem with the CommandArgument part but I
    > can't figure out what it is. I've been trying different uses of single
    > and double quotes thinking maybe that was it but it still hasn't started
    > working. Can anyone see what I did wrong there? Thanks!
    >
    > Matt
    , Jan 25, 2008
    #2
    1. Advertising

  3. MattB

    Jignesh Guest

    Closing brackets of Eval function is missing

    Regards
    JIGNESH

    "MattB" <> wrote in message
    news:...
    > I'm trying to put a Link button in the ItemTemplate of a repeater. I've
    > created/wired the handler event, and I'm just trying to make the
    > LinkButton pass what I need to that event. I thought I had it right, but I
    > get a parser error when running this page. LinkButton looks like this:
    >
    > <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    > CommandArgument='<%# DataBinder.Eval(Container.DataItem,
    > "id"%>')>Remove</asp:LinkButton>
    >
    > I'm pretty sure there is a problem with the CommandArgument part but I
    > can't figure out what it is. I've been trying different uses of single and
    > double quotes thinking maybe that was it but it still hasn't started
    > working. Can anyone see what I did wrong there? Thanks!
    >
    > Matt
    Jignesh, Jan 25, 2008
    #3
  4. MattB

    MattB Guest

    Ah! Thanks. It's always the simplest problems that are the hardest to see.

    Matt

    am wrote:
    > I believe there is a syntax error. Try this instead:
    >
    > <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    > CommandArgument='<%# DataBinder.Eval(Container.DataItem,"id")
    > %>'>Remove</asp:LinkButton>
    >
    >
    > On Jan 24, 2:53 pm, MattB <> wrote:
    >> I'm trying to put a Link button in the ItemTemplate of a repeater. I've
    >> created/wired the handler event, and I'm just trying to make the
    >> LinkButton pass what I need to that event. I thought I had it right, but
    >> I get a parser error when running this page. LinkButton looks like this:
    >>
    >> <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    >> CommandArgument='<%# DataBinder.Eval(Container.DataItem,
    >> "id"%>')>Remove</asp:LinkButton>
    >>
    >> I'm pretty sure there is a problem with the CommandArgument part but I
    >> can't figure out what it is. I've been trying different uses of single
    >> and double quotes thinking maybe that was it but it still hasn't started
    >> working. Can anyone see what I did wrong there? Thanks!
    >>
    >> Matt

    >
    MattB, Jan 25, 2008
    #4
  5. MattB

    MattB Guest

    Thank you!

    Matt

    Jignesh wrote:
    > Closing brackets of Eval function is missing
    >
    > Regards
    > JIGNESH
    >
    > "MattB" <> wrote in message
    > news:...
    >> I'm trying to put a Link button in the ItemTemplate of a repeater.
    >> I've created/wired the handler event, and I'm just trying to make the
    >> LinkButton pass what I need to that event. I thought I had it right,
    >> but I get a parser error when running this page. LinkButton looks like
    >> this:
    >>
    >> <asp:LinkButton id="lbDel" runat="server" CommandName="delete"
    >> CommandArgument='<%# DataBinder.Eval(Container.DataItem,
    >> "id"%>')>Remove</asp:LinkButton>
    >>
    >> I'm pretty sure there is a problem with the CommandArgument part but I
    >> can't figure out what it is. I've been trying different uses of single
    >> and double quotes thinking maybe that was it but it still hasn't
    >> started working. Can anyone see what I did wrong there? Thanks!
    >>
    >> Matt

    >
    MattB, Jan 25, 2008
    #5
    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. =?Utf-8?B?QmVuamFtaW4gSm9sZGVyc21h?=

    LinkButton CommandArgument bound property loses value on postback

    =?Utf-8?B?QmVuamFtaW4gSm9sZGVyc21h?=, Aug 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,107
    =?Utf-8?B?QmVuamFtaW4gSm9sZGVyc21h?=
    Aug 21, 2004
  2. Patrick Olurotimi Ige

    commandargument in linkbutton Question

    Patrick Olurotimi Ige, Jun 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,261
    Patrick Olurotimi Ige
    Jun 20, 2005
  3. Sathyaish
    Replies:
    3
    Views:
    3,098
    Sathyaish
    Sep 8, 2005
  4. Replies:
    3
    Views:
    13,441
    swati254
    Dec 23, 2008
  5. lax4u
    Replies:
    0
    Views:
    798
    lax4u
    Mar 13, 2008
Loading...

Share This Page