sending more parameter from imagebutton ....

  • Thread starter Thread starter Adam Right
  • Start date Start date
A

Adam Right

Hi All,

i am using CommandArgument of imagebutton in a Repeater for adding a item to
shopping basket, like that;
**************************
<asp:Repeater ID="Repeater1" runat="server"
OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<asp:ImageButton ID="addToBasket" runat ="server" CommandArgument='<%#
DataBinder.Eval(Container.DataItem,"STOCK_CODE")%>'
ImageUrl="Images/shop/addbasket_24.gif" />
</ItemTemplate>
</asp:Repeater>
**************************
and then, in code-behind, i catch the ItemCommand event of repeater for
adding item to basket with three parameters...
**************************
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs
e)
{
string par1 = e.CommandArgument.ToString();
Basket.AddItem(par1,par2,par3);
}
**************************
But i can get only one parameter from imagebutton.
Is it possible to send all params(par1,par2 and par3) via the
"CommandArgument" ?

I mean, i have to get the all parameters(par1,par2,par3) from
"ImageButton" to accomplish the process via the Basket.AddItem() method...

Any idea for sending more parameter via the imagebutton control or similar
way ?

Thanks.

Adam
 
You could set the CommandArgument of the imagebutton to a comma seperated
list of values and in your ItemCommand split the e.CommandArgument this
would give you an array of values which you can pass in to your func (might
not be the best solution but it works)
 
Back
Top