Hi all. This is my first post to this forum so hopefully it won't be too cringe.
I have a WebHierarchicalDataGrid that is bound to WebHierarchicalDataSource. The parent table has a SQL autonumber ID.
In the parent row, I've added a template column with a "Save" button. The button has a CommandName and CommandArgument (code below) that references the row's ID column. All of this works great. The command is called on the server when the button is clicked and the server creates an Excel file with the data from the given record ID that's downloaded to the client.
So, the issue I just discovered is that if a new record is added (via another user on a different computer) while this page is displayed, the CommandArgument doesn't reference the ID in the same row as the button. Instead, it references the ID of the row above it. However, when I refresh the page, the ID is correct. Any thoughts on this? I've told the end user that they should just refresh the page before clicking the button but they would like to fix this in case the user just forgets to refresh and the file that's downloaded is not the one they requested.
Thanks!
P.S. I also tried using the Row Index instead but that had the same result.
Here's the WHDG header.
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Height="600px" Width="100%" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="ID" DataMember="transDataSource_DefaultView" DataSourceID="WebHierarchicalDataSource1" Key="transDataSource_DefaultView" OnItemCommand="WebHierarchicalDataGrid1_ItemCommand">
Here's the template column with the button.
<ig:TemplateDataField Key="Save"> <ItemTemplate> <asp:Button ID="Button1" runat="server" Text="Save" CommandName="SaveTransaction" CommandArgument='<%# Eval("ID") %>' /> </ItemTemplate> </ig:TemplateDataField>
Hello Joey,
I have created a sample using WebHierarchicalDataGrid with template column containing a button and Add New Row feature, however, on my side the correct command argument is passed to the method when new row is added.
Below I am attaching the prepared sample. Could you please modify it in order to demonstrate the described behaviour and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach in in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Additionally, what I could suggest is enabling the Activation feature and accessing the current row from the active cell in the WebHierarchicalDataGrid1_ItemCommand method. This could be achieved as follows:
protected void WebHierarchicalDataGrid1_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e)
{
GridRecord row = WebHierarchicalDataGrid1.GridView.Behaviors.Activation.ActiveCell.Row;
}
Thank you for your cooperation.
Looking forward to hearing from you.
Regards, Monika Kirkova, Infragistics
WebHierarchicalDataGridDataSource.zip
Thanks. I'll look into this. One thing I forgot to mention is that I'm using an older version of the control, Infragistics4.Web.v14.1. The specific dll version is 14.1.20141.2392. So perhaps this was an issue that was fixed a long time ago.
Take your time in testing the provided project. Additionally, please keep in mind that according to our support policy Infragistics products have one year of product service releases and three years of developer support. This means that version 14.1 is considered retired and it is no longer eligible for Developer Support Services.
Since the the behavior is not reproduced in my sample using a newer version of the controls I assume that this might be caused by an issue that we have addressed, fixed and released in any of the latest versions of our product.
In the following topic you could find which versions we are supporting and when will their support expire.
Please let me know if you need additional information regarding this matter.
The Activation feature worked! Thanks, Monika.