0

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.

1 Answer 1

2

Set CommandName and CommandArgumentof 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.