Hi,
I am facing an issue in firing the ItemCommand event of infragistics webgrid, the description of which is as follows
I have a link button control through out a column in infragistics webgrid which is binded to database. My application's functionality demands fetching some value through a web service upon clicking the link button. Also i have certain code written in webgrid's Click and ActiveRowChange events. Now when i click on the link button, i am not able to get through the ItemCommand event of webgrid. I have written the code to call my webservice in ItemCommand event. I expect that event to fire when i click the link button.
Any kind of help would be highly appreciable.
Thanks
Ashish
Thanks for the response. It was the DataBind call in the initializeDataSource event handler that was causing the issue. Removing it has fixed the problem. Thank you for the quick response.
-Daniel
Hello,
There are a few lines of code in the sample you provided that might be problematic.
1) The InitializeDataSource event needs to be used just to hook the event. DataBind() should not be called - it will be called internally by the grid itself.
2) You probably do not need the DataBinding event in this case -- just move the code to InitializeDataSource -- this should be fine.
3) How is the Browser="Xml" affecting this? If you remove this property, do you get better results?
I too am experiencing the same issue. The ItemCommand event does not get fired for my button in my grid. Oddly, if I click on a column to sort it first, then click the button, the event fires. Below is the code I have:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Browser="Xml" Height="200px" Width="325px"> <bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="Name" IsBound="True" Key="Name"> <Header Caption="Name"> </Header> </igtbl:UltraGridColumn> <igtbl:TemplatedColumn Key="Update"> <CellTemplate> <asp:Button ID="Button1" CommandName="Foo" runat="server" Text="Button" /> </CellTemplate> <Header Caption="Update"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:TemplatedColumn> </Columns> <RowEditTemplate> <br> <p align="center"> <input id="igtbl_reOkBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width:50px;" type="button" value="OK"> <input id="igtbl_reCancelBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width:50px;" type="button" value="Cancel"> </input> </input> </p> </br> </RowEditTemplate> <RowTemplateStyle BackColor="Window" BorderColor="Window" BorderStyle="Ridge"> <BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" /> </RowTemplateStyle> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> </igtbl:UltraGridBand> </bands> <displaylayout allowcolsizingdefault="Free" allowcolumnmovingdefault="OnServer" allowdeletedefault="Yes" allowsortingdefault="OnClient" allowupdatedefault="Yes" bordercollapsedefault="Separate" headerclickactiondefault="SortMulti" loadondemand="Xml" name="UltraWebGrid1" rowheightdefault="20px" rowselectorsdefault="No" selecttyperowdefault="Extended" stationarymargins="Header" stationarymarginsoutlookgroupby="True" tablelayout="Fixed" version="4.00"> <framestyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt" height="200px" width="325px"> </framestyle> <pager minimumpagesfordisplay="2"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </PagerStyle> </pager> <editcellstyledefault borderstyle="None" borderwidth="0px"> </editcellstyledefault> <footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </footerstyledefault> <headerstyledefault backcolor="LightGray" borderstyle="Solid" horizontalalign="Left"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </headerstyledefault> <rowstyledefault backcolor="Window" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt"> <padding left="3px" /> <borderdetails colorleft="Window" colortop="Window" /> </rowstyledefault> <groupbyrowstyledefault backcolor="Control" bordercolor="Window"> </groupbyrowstyledefault> <groupbybox> <boxstyle backcolor="ActiveBorder" bordercolor="Window"> </boxstyle> </groupbybox> <addnewbox hidden="False"> <boxstyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </boxstyle> </addnewbox> <activationobject bordercolor="" borderwidth=""> </activationobject> <filteroptionsdefault> <filterdropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px" height="300px" width="200px"> <padding left="2px" /> </filterdropdownstyle> <filterhighlightrowstyle backcolor="#151C55" forecolor="White"> </filterhighlightrowstyle> <filteroperanddropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px"> <padding left="2px" /> </filteroperanddropdownstyle> </filteroptionsdefault> </displaylayout> </igtbl:UltraWebGrid>
protected override void OnInit(EventArgs e) { UltraWebGrid1.DataBinding += new EventHandler(UltraWebGrid1_DataBinding); UltraWebGrid1.InitializeDataSource += new Infragistics.WebUI.UltraWebGrid.InitializeDataSourceEventHandler(UltraWebGrid1_InitializeDataSource); UltraWebGrid1.ItemCommand += new Infragistics.WebUI.UltraWebGrid.ItemCommandEventHandler(UltraWebGrid1_ItemCommand); UltraWebGrid1.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(UltraWebGrid1_InitializeLayout); base.OnInit(e); }
void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) { e.Layout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.RowTemplateOnly; }
void UltraWebGrid1_ItemCommand(object sender, Infragistics.WebUI.UltraWebGrid.UltraWebGridCommandEventArgs e) { }
void UltraWebGrid1_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e) { UltraWebGrid1.DataBind(); }
void UltraWebGrid1_DataBinding(object sender, EventArgs e) { List<User> users = new List<User>(); users.Add(new User("foo")); users.Add(new User("bar"));
UltraWebGrid1.DataSource = users; }
public class User
{
//
// TODO: Add constructor logic here
}
Name = name;
Any help would be greatly appreciated.
I am trying to reproduce the issue, unfortunately to no avail. I use NetAdvantege 8.3.Please take a look at the code below:
Aspx:<igtbl:UltraWebGrid ID="UltraWebGrid1" DataSourceID="SqlDataSource1" runat="server"> <Bands> <igtbl:UltraGridBand> <Columns> <igtbl:TemplatedColumn> <CellTemplate> <asp:LinkButton ID="LinkButton1" CommandName="DELL" runat="server">LinkButton</asp:LinkButton> </CellTemplate> </igtbl:TemplatedColumn> <igtbl:UltraGridColumn Key="ProductName" BaseColumnName="ProductName" Type="Button" HeaderText="ProductName"> <Footer Key="ProductName"> </Footer> <Header Key="ProductName" Caption="ProductName"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn Key="ProductName" BaseColumnName="ProductName" Type="HyperLink" HeaderText="ProductName"> <Footer Key="ProductName"> </Footer> <Header Key="ProductName" Caption="ProductName"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn Key="ProductName" BaseColumnName="ProductName" HeaderText="ProductName"> <Footer Key="ProductName"> </Footer> <Header Key="ProductName" Caption="ProductName"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn Key="SupplierID" BaseColumnName="SupplierID" HeaderText="SupplierID"> <Footer Key="SupplierID"> </Footer> <Header Key="SupplierID" Caption="SupplierID"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn Key="CategoryID" BaseColumnName="CategoryID" HeaderText="CategoryID"> <Footer Key="CategoryID"> </Footer> <Header Key="CategoryID" Caption="CategoryID"> </Header> </igtbl:UltraGridColumn> </Columns> </igtbl:UltraGridBand> </Bands> </igtbl:UltraWebGrid>C#protected override void OnInit(EventArgs e) { base.OnInit(e); UltraWebGrid1.ActiveRowChange += new Infragistics.WebUI.UltraWebGrid.ActiveRowChangeEventHandler(UltraWebGrid1_ActiveRowChange); UltraWebGrid1.Click += new Infragistics.WebUI.UltraWebGrid.ClickEventHandler(UltraWebGrid1_Click); UltraWebGrid1.ItemCommand += new Infragistics.WebUI.UltraWebGrid.ItemCommandEventHandler(UltraWebGrid1_ItemCommand); } void UltraWebGrid1_ActiveRowChange(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { } void UltraWebGrid1_Click(object sender, Infragistics.WebUI.UltraWebGrid.ClickEventArgs e) { } void UltraWebGrid1_ItemCommand(object sender, Infragistics.WebUI.UltraWebGrid.UltraWebGridCommandEventArgs e) { } protected void Page_Load(object sender, EventArgs e) { }
Could you please send a little bit more information about the UltraWebGrid declaration. ASPX declaration, code-behind – anything that can get us started is welcome. Because can be have many reason for that issue.
Thanks.