Jul 13 2005

TemplateField in GridView

Category: ASP.NET 2.0 - GeneralBil@l @ 23:43

You can call a custom method inside the TemplateField of the GridView as follows:

<TemplateField>
  <ItemTemplate>
      <%# GetSum((int)Eval(“Number1“), (int)Eval(“Number2“)) %>
  </ItemTemplate>
</TemplateField>

public string GetSum(int num1, int num2)
{
     return (num1+num2).ToString();
}

Hope that helps,

Regards

Tags:

Comments are closed