Can I use command buttons on WHDG rows? I don't see any support for that in the tags or docs.
Hello ,
You can add ItemCommand in the following way :
whdg1.GridView.ItemCommand +=
new Infragistics.Web.UI.GridControls.ItemCommandEventHandler(whdg1_ItemCommand);
Let me know if you need more assistance regarding this.
I added the following and the even is still not firing
salesGrid.GridView.ItemCommand += new ItemCommandEventHandler(salesGrid_itemCommand);
public void InstantiateIn(Control container) { System.Web.UI.WebControls.ImageButton a = new System.Web.UI.WebControls.ImageButton(); arg = (String)DataBinder.Eval(container, "DataItem." + arg).ToString(); a.ImageUrl = imageURL; a.CommandName = commandName; a.CommandArgument = arg; a.EnableViewState = true; a.CausesValidation = true; //a.Text = display; a.ID = arg; //a.Command += serverEvtHandler; //a.Click += serverEvtHandler; a.AlternateText = display; container.Controls.Add(a); } This is the event handler that I keep the debug set on and it never gets here protected void salesGrid_itemCommand(object sender, HandleCommandEventArgs e) { if (sender is ImageButton) { ImageButton source = (ImageButton)sender; String id = source.ID; } } Not sure what to do I feel like I tried everything BTW it is a WHDG
public void InstantiateIn(Control container) { System.Web.UI.WebControls.ImageButton a = new System.Web.UI.WebControls.ImageButton(); arg = (String)DataBinder.Eval(container, "DataItem." + arg).ToString(); a.ImageUrl = imageURL; a.CommandName = commandName; a.CommandArgument = arg; a.EnableViewState = true; a.CausesValidation = true; //a.Text = display; a.ID = arg; //a.Command += serverEvtHandler; //a.Click += serverEvtHandler; a.AlternateText = display; container.Controls.Add(a);
}
This is the event handler that I keep the debug set on and it never gets here protected void salesGrid_itemCommand(object sender, HandleCommandEventArgs e) { if (sender is ImageButton) { ImageButton source = (ImageButton)sender; String id = source.ID; } }
Not sure what to do I feel like I tried everything BTW it is a WHDG