Link to home
Start Free TrialLog in
Avatar of Meps
MepsFlag for United States of America

asked on

Button Onclick event within a Repeater?

I think this is pretty easy, but I just can't seem to get it to work.

What I want to do is have the onclick fire off the function that I created for it.
------------------ASP.Net Page------------------------------
    <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
            <asp:Button ID="btnProduct" runat="server" Text='<%#  DataBinder.Eval(Container.DataItem, "Products")%>' OnClick='SelectProduct(<%#  DataBinder.Eval(Container.DataItem, "ProductID")%>)' />
        </ItemTemplate>
    </asp:Repeater>
 
 
 
------------------------Code--------------------------------
    protected void SelectProduct(int ProductID)
    {
        AnswerMainDTO AuditAnswer = (AnswerMainDTO)Session["AuditAnswer"]; 
        AuditAnswer.Product = ProductID;
        Session["AuditAnswer"] = AuditAnswer;
        Response.Redirect("~/AuditMain.aspx");
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of crazyman
crazyman
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Meps

ASKER

Works perfectly, Thank you so much.