sending more parameter from imagebutton ....

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
 
M

Misbah Arefin

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top