Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ASP
Posted by: Mario Lopes
Added: Oct 25, 2018 11:46 AM
Modified: Oct 25, 2018 11:57 AM
Views: 106
  1. 1. CommandName="Comprar" CommandArgument='<%# Eval("id") %>'
  2.  
  3. 2. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  4.     {
  5.         if (e.CommandName != "Comprar") return;
  6.         int id = Convert.ToInt32(e.CommandArgument);
  7.         Response.Write(id);
  8.     }
  9.  
  10. Mais que um CommandArgument
  11. CommandArgument='<%#Eval("id") + ";" +Eval("mensagem")%>'
  12.  
  13. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  14.     {      
  15.         string[] arg = new string[2];
  16.         arg = e.CommandArgument.ToString().Split(';');
  17.         Response.Write(arg[0].ToString());
  18.         Response.Write(arg[1].ToString());
  19.     }
  20.