Hi, I am migrating from 11.1 to 13.2, I have this code in the click event of a link that's inside a templateDataField in a WebHierarchicalGrid:
protected void lnkEditBoard_Click(object sender, EventArgs e) { var replacementDate = GetRateGridCurrentRow().Items.FindItemByKey("ReplacementDate").Value as DateTime?;
LinkButton lnk = sender as LinkButton;
CellItem parentCell = (CellItem)lnk.NamingContainer;
var BoarId = parentCell.Cell.Row.Items.FindItemByKey("BoardId").Value.ToString();
}
Here's the templateDataField:
<ig:TemplateDataField Width="310px" Key="lnkBoardsColumn"> <ItemTemplate> <asp:LinkButton ID="lnkEditBoard" OnClick="lnkEditBoard_Click" runat="server" ForeColor="Navy"> <%# DataBinder.Eval(Container, "DataItem.Description")%> </asp:LinkButton> </ItemTemplate> <FooterTemplate> <asp:LinkButton ID="lnkAddBoard" OnClick="lnkAddBoard_Click" runat="server" ForeColor="Black" Font-Bold="true" Font-Size="X-Small">Add Board</asp:LinkButton> </FooterTemplate> <Footer CssClass="footerStyle"> </Footer> </ig:TemplateDataField>
Hello Nicole,
Thank you for posting in our forum.
Please note that code re-writing will be only needed if you are shifting from the retired classic controls to the new Aikido-based ones. NetAdvantage 2011.1 contains both the classic and the new packages of controls. As far as I could understand from your code snippet you it seems that you are already using the new controls so this code is expected to work in 13.2.
Have you encountered any issues while implementing this code with 13.2?
I have added below for your reference articles describing the item template implementation in 13.2:
http://help.infragistics.com/Doc/ASPNET/2013.2/CLR4.0/?page=WebDataGrid_Using_Item_Template.html
http://help.infragistics.com/Help/Doc/ASPNET/2013.2/CLR4.0/html/WebHierarchicalDataGrid_Using_Item_Template.html
If you need any further assistance please let me know.
Yes, my code is not compiling, of course. Because the "CellItem" does not longer exist, if you read my post carefully, I make it clear that I am migrating from 11.1 to 13.2, hence I need yo re-write my code.
I have a template field with a link inside it, on the "onclick" event of that link I need to obtain which row contains the clicked link.
In my 11.1 I did it like this:
protected void lnkEditBoard_Click(object sender, EventArgs e) {
var row = parentCell.Cell.Row;
but as I said earlier, I no longer have the CellItem class, since I am migrating to 13.2
Thank you for your help.