Can someone please give me an example of how to code the ItemCommand event for this new WebGrid?
I have had to upgrade from the old WebDataGrid to this new one and I have a Templated columnwith two image buttons in it.I need to cod the ItemCommand event to handle the clicking of those two images and I can't figureout how to do it in this new grid.
In the old grid, I would set a variable to the parentitem and use e.command to get the button.
I have also been looking for an example on how to code the ItemCommand event for this new WebDataGrid. I can't find the event handler to perform this.
Thanks.
I set a break point in the event to see if I could figure it out, and when I clicked on one of my buttons it never even hit the breakpoint. It does not even appear to be getting into the event.
I like the IG controls, but this has always been my biggest complaint. There are no where near enough examples of how to do things and the documentation leave A LOT to be desired.
Hello,
I just tried described scenario, everything seems to be ok. Here is what I tried. One of the columns is a templated one and there is an imagebutton in it with CommandName set. When clicking the button the ItemCommand event off the grid itself fires ok:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="500px" width="800px"
AutoGenerateColumns="False"
onitemcommand="WebDataGrid1_ItemCommand">
<Columns>
<ig:TemplateDataField Key="ContactName" Width="200px">
<ItemTemplate>
<asp:Label ID="Label1" runat="server"><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "ContactName") %></asp:Label>
<asp:ImageButton ID="ImageButton1" runat="server"
CommandName="ImageButtonClick"
ImageUrl="~/ig_res/Default/images/ActiveRowSelector.gif" />
</ItemTemplate>
<Header Text="Contact Name" />
</ig:TemplateDataField>
protected void Page_Load(object sender, EventArgs e)
{
this.WebDataGrid1.DataSource = orders;
}
protected void WebDataGrid1_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e)
Hi,
How would I put commandargument into the imagebutton so I can use it in 'e' in the event procedure?
I've tried with:
<ig:TemplateDataField Key="ChooseLotNum"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" CommandName="ImageButtonClick" CommandArgument='<%# Container.Cell.Row.Index%>' ImageUrl="./SearchIcon.png" /> </ItemTemplate> <Header Text="Find Lot" /> </ig:TemplateDataField>
but I get an error: 'Cell' is not a member of 'System.Web.UI.Control'.
Thanks, Ed
Hello, I know this is an old thread, but was it ever resolved? I need to determine the clicked row from the the Itemcommand event when clicking an image button.