Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

asp.net 2 question - asp:repeater

Back to Forum: Tech Off
  • User profile image
    Galapagos​Niltch

    Hi,

    Any help anyone can give me would be greatly appreciated.

    I'm using an asp:repeater, and within the itemtemplate i have an asp:imagebutton.  I need to keep it an asp:imagebutton as opposed to just an img because i am using 2.0 themes/skins.  So several of these get created by the repeater and they all have something along the lines of OnClientClick="javascript: whatever(id);"  (the id changes by for each one).

    My problem is that i want the repeater and the themes to work, but i don't want these image buttons to trigger a post back.  I want them to run the javascript and have done.  I tried returning false from the javascript routine, but i seem to still get a post back.  I found that if I do something like MyImageButton.Attributes["OnClick"] = "return false;" it seems to work fine for a single image button out on its own but not for a series of image buttons generated within a repeater.

    Thanks for any suggestions or help,
    GN

  • User profile image
    cokert

    what about OnClientClick="javascript: whatever(id);return false;"

    ie, just append return false; to your client side on click event?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.