Problems with button in a repeater

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pnr

    Problems with button in a repeater

    I have an repeater that contains data witch it schould be possible to
    delete, I have placed a delete button in each row, but i can't make
    it work :-(

    This is my repeater (just a little bit of it):

    <asp:repeater id="Repeater1" runat="server"
    OnItemCommand=" testKnap_Click" >

    <ItemTemplate >

    <asp:Button Text=<%# DataBinder.Eval (Container.Data Item,
    "nyhedsNr") %> runat=server
    ID="testKnap"> </asp:Button>

    </ItemTemplate>


    and the cs file:

    private void InitializeCompo nent()
    {
    this.Repeater1. ItemCommand += new
    System.Web.UI.W ebControls.Repe aterCommandEven tHandler(this.t estKnap_Click);
    this.Load += new System.EventHan dler(this.Page_ Load);

    }

    protected void testKnap_Click( object source,
    System.Web.UI.W ebControls.Repe aterCommandEven tArgs e)
    {
    Response.Write( "HERE" + e.CommandName.T oString());

    }


    It submits when i hit the button, but it dosen't write the text from
    Response.Write. .

    Any one that can help me make it work?


    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    Best Usenet Service Providers 2025 ranked by Newsgroup Access Newsservers, Usenet Search, Features & Free Trial. Add VPN for privacy.

  • Natty Gur

    #2
    Re: Problems with button in a repeater

    Hi,

    1) I run your code on my machine and it works.
    2) You attached the event twice (by adding to delegate (page_init) and
    using attribute (HTML)) so actually the repeater event will be call
    twice. You should use one of those options.

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • pnr

      #3
      re:Problems with button in a repeater

      I have tried everything, but i can't make it work. Do you have an
      idear too what could be wrong?



      ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
      http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
      ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

      Comment

      Working...