title: pass two parameter to event handler
body: <p>hello everyone i struggling to pass two parameter to an event handler basically when the page is load it dynamically create some control lable, textfield, and linkbutton when i click on the link button it fire an event handler, here is my problem i want to pass first the Product ID and quantity, the product id is fetch from the database passit thorugh an object where as the quantity it enter by the user</p>
  
  <p>first part of the code it connect to database loop through and display all record on the page dynamcally</p>
  
  <hr>
  
  <pre><code>Function test()
  
      Dim objTemlDall As New Dallyarer
      arr = objTemlDall.getRecord()
  
      Dim lblname As Label
      Dim lblDes As Label
      Dim lblPrice As Label
      Dim linkItem As LinkButton
  
  
      Dim objTemProduct As Product
      For Each objTemProduct In arr
  
          lblname = New Label
          lblDes = New Label
          lblPrice = New Label
          linkItem = New LinkButton
          txtQuantity = New TextBox
  
  
  
  
          PrdName.Controls.Add(New LiteralControl("&lt;br /&gt;"))
          lblname.Text = objTemProduct.Name
          PrdName.Controls.Add(lblname)
          PrdName.Controls.Add(New LiteralControl("&lt;br /&gt;"))
  
          PrdDesc.Controls.Add(New LiteralControl("&lt;br /&gt;"))
          lblDes.Text = objTemProduct.ShortDescription
          PrdDesc.Controls.Add(lblDes)
          PrdDesc.Controls.Add(New LiteralControl("&lt;br /&gt;"))
  
          PrdPrice.Controls.Add(New LiteralControl("&lt;br /&gt;"))
          lblPrice.Text = objTemProduct.UnitPrice
          PrdPrice.Controls.Add(lblPrice)
          PrdPrice.Controls.Add(New LiteralControl("&lt;br /&gt;"))
  
          PrdQuantity.Controls.Add(New LiteralControl("&lt;br /&gt;"))
          txtQuantity.ID = "qty"
          PrdQuantity.Controls.Add(txtQuantity)
  
          PrdQuantity.Controls.Add(New LiteralControl("&lt;br /&gt;"))
  
  
  
          linkItem.Text = "Add to Cart"
          linkItem.ID = objTemProduct.ProductID
          linkItem.CommandArgument = objTemProduct.ProductID
          PrdAddToCart.Controls.Add(New LiteralControl("&lt;br /&gt;"))
          PrdAddToCart.Controls.Add(linkItem)
          PrdAddToCart.Controls.Add(New LiteralControl("&lt;br /&gt;"))
  
          AddHandler linkItem.Click, AddressOf GetSelectedProduct
  
      Next objTemProduct
  
  End Function
  </code></pre>
  
  <p>second part when it fire event handler i want to pass txtQuantity data to GetSelectedProduct event handler how can i achieve that please</p>
  
  <pre><code>Function GetSelectedProduct(ByVal sender As Object, ByVal e As EventArgs)
  
      SelectedProduct = New Product
      Dim lbLink As LinkButton = CType(sender, LinkButton)
      SelectedProduct.ProductID = lbLink.CommandArgument
  
  
  
      Dim objTemlCart As New Dallyarer
      arr = objTemlCart.getRecord()
  
      Dim objT As Product
  
      For Each objT In arr
          If objT.ProductID = SelectedProduct.ProductID Then
              SelectedProduct.ProductID = objT.ProductID
              SelectedProduct.Name = objT.Name
              SelectedProduct.UnitPrice = objT.UnitPrice
          End If
      Next objT
  
  
      If Page.IsValid Then
          Dim CartItem As New CartItem
          CartItem.Product = SelectedProduct
          'CartItem.Quantity = CType(Me.txtQuantity.Text, Integer)
          Me.AddToCart(CartItem)
      End If
  
  
  End Function
  </code></pre>
  
  <p>thank you</p>