Ho dichiarato un array di 4 pulsanti:
codice:
private string[] idBottoni = new string[4]{"b1","b2","b3","b4"};
Poi ho un datagrid dove ad ogni riga ho 4 pulsanti dichiarati così:
codice:
asp:button runat="server" Text="+" ID="b1"></asp:button>
Nell'itemDataBound associo ad ognuno dei 4 bottoni command name e argument
codice:
		private void RepEventi_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) 
		{ 
			if(e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem) 
			{ 
				foreach(string s in idBottoni) 
				{ 
					Button bottone = e.Item.FindControl(s) as Button; 
					if(bottone != null) 
					{ 
						bottone.CommandArgument = "pippo"; 
						bottone.CommandName = "pluto";
					} 
				} 
			} 
		}
Nel ItemCommand faccio il response.write del command argument
codice:
		public void RepEventi_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) 
		{ 
			if(!(e.CommandArgument.ToString() == null))
			{
							Response.Write("il command argument è: " + e.CommandArgument.ToString()); 
							}
}
il problema è che in fase di visualizzazone nel response.write non appare il command argument, come se fosse nullo.