Hello,
with Infragistics v14.2 I am not able to find a servercontrol inside a TemplateDataField. My ASPX-Code looks like this:
<ig:WebDataGrid ID="wdgData" runat="server" EnableViewState="True" EnableDataViewState="True" DataKeyFields="Product" AutoGenerateColumns="false"> <Columns> <ig:BoundDataField Key="Prodduct" DataFieldName="Product" Header-Text="Product"></ig:BoundDataField> <ig:TemplateDataField Key="Comment"> <ItemTemplate> <asp:TextBox ID="txtComment" runat="server"></asp:TextBox> </ItemTemplate> </ig:TemplateDataField> </Columns> </ig:WebDataGrid>
The grid is filled on PageLoad and shows the data as expected. However when I click an ASP.NET - Button my code is not able to get the TextBox. The code looks like this:
void btnButton_Click(object sender, EventArgs e) { foreach (Infragistics.Web.UI.GridControls.GridRecord r in wdgData.Rows) { TextBox textbox = (TextBox)r.Items[0].FindControl("txtValue");
if (textbox != null) // -> always null { //Do something with the textboxvalue }
} }
The project is configured to use .NET 4.5. If I set up a project using .NET 3.5 and Infragistics v12.2 my code is running fine and working as expected. Is there anything that has changed from v12.2 to v14.2?
Thank you for contacting Infragistics!
I have done some looking into this matter and I believe you are unable to get the textbox because of the id you are trying to find it by. You are trying to find it by “txtValue” when in your markup you have the textbox have the ID of “txtComment”
What happens when you use “txtComment” to find the textbox?
Please let me know if you have any questions concerning this matter.
I'm sorry, this was just a copy-paste-error. In my code the name equals "txtComment".
So this does not work:
void btnButton_Click(object sender, EventArgs e){ foreach (Infragistics.Web.UI.GridControls.GridRecord r in wdgData.Rows) { TextBox textbox = (TextBox)r.Items[0].FindControl("txtComment");
}}