Reputation:
I have a quoting system that can generate several variants of a quote. these quotes are displayed on a screen for sales staff to compare and choose which is the most suitable. Is it possible to programmatically create a button and click event for each quote that is generated?
Each quote needs a save button and a remove button. both would fire functions and pass in the quite ID.
Can anyone point me in the correct direction for this? the amount of quotes and buttons that could be on the page is limitless.
Many thanks for your help.
Upvotes: 0
Views: 544
Reputation: 3883
Set CommandName
and CommandArgument
of your button template and catch the event inside ItemCommand
event of your repeater
<asp:Repeater runat="server" ID="rptrQuites">
<ItemTemplate>
<asp:LinkButton ID="btnSave" Text="Save" CommandName="Save" CommandArgument="<%#Eval("QuiteID")"%>></asp:LinkButton>
</ItemTemplate>
</asp:repeater>
and in code behind
Protected Sub rptrQuites_ItemCommand(source As Object, e As RepeaterCommandEventArgs) Handles rptrQuites.ItemCommand
If e.CommandName = "Save"
' Put your code here
End If
End Sub
Upvotes: 2