Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Get text value from TemplateDataField
posted

Is it possible to get the text value of TemplateDataField, I have 

<ig:TemplateDataField Key="Result" Header-Text=" Status" Width="270px" VisibleIndex="9">

  <Header Text=" Status" />

  <ItemTemplate>

    <asp:Literal runat="server" Text='<%# Eval("Result") %>'></asp:Literal>

    <asp:LinkButton>ABC</asp:LinkButton>

    <asp:LinkButton>XYZ</asp:LinkButton>

  </ItemTemplate>
</ig:TemplateDataField>

Tried WebDataGrid.GridRecord.FindItemByKey("Result").Text but seems value return is not proper. Is there any way to get Eval("Result")? 

  • 2680
    Offline posted

    Hello,

    Thank you for contacting Infragistics support.

    This is the code snippet you need:

    Literal pNameLiteral = this.WebDataGrid1.Rows[0].Items[1].FindControl("pName") as Literal;
    string productName = pNameLiteral.Text;

    I am attaching a working project.

    Please let me know if you need further assistance.

    GettingTemplateFieldValue.zip