2

I have a TemplateField column in a gridview with a image button inside of it. i need to use two command arguments within single image button. here is my code

<asp:TemplateField ItemStyle-Width="30px">
     <ItemTemplate>
         <asp:ImageButton ID="btnAvaililabitly" runat="server" 
                          ImageUrl="~/CMS/images/available_icon.png"
                          Width="12px" Height="12px" CommandName="availability" 
                          ToolTip="Rooms Availability"
                          CommandArgument='<%#Eval("HotelID")%>'/>
     </ItemTemplate>
</asp:TemplateField>

please help

Kaf
  • 33,101
  • 7
  • 58
  • 78
aami
  • 297
  • 2
  • 8
  • 20
  • Why? Do you have a key for the table that you list here? Then use that. However,you can use a separator(e.g. comma) and split it on serverside. – Tim Schmelter Mar 21 '13 at 11:52
  • I formatted your markup to make it neat and tidy. – Kaf Mar 21 '13 at 11:57
  • possible duplicate of [Passing multiple argument through CommandArgument of Button in Asp.net](http://stackoverflow.com/questions/2389258/passing-multiple-argument-through-commandargument-of-button-in-asp-net) – Tim Schmelter Mar 21 '13 at 11:59

1 Answers1

5

You can send comma separated string and collect value on server side

CommandArgument= '<%# String.Format("{0} , {1}", Eval("Name1"), Eval("Name2")) %>'
Adil
  • 146,340
  • 25
  • 209
  • 204