Created On: 16 December 2010
Problem:
How do you use COBOL syntax on an ASP.NET Web page to call Eval method for binding?
Resolution:
The .NET Framework Eval method is used on a web page to dynamically assign a value to an object in COBOL.
For example, if you wanted to bind the value of the ProductID object to the text property of a grid column you could use the following:
...
<ItemTemplate>
<asp:Label ID="ProductID" runat="server" Text='<%# super::"Eval"("ProductID") %>'></asp:Label>
</ItemTemplate>
' runat="server">
If you are using this type of code on a web page in an ASP.NET Web application then you will also have to update your .aspx to include Language="COBOL" on the page.
We don't specify the Language property by default so that aspx pages don't generate a reference to our CodeDom, so that it is not required on a deployment
machine unless absolutely necessary.
It is necessary for these pages, however, as they include COBOL code.
For example: Page AutoEventWireup="true" MasterPageFile="~/Site.master" Language="COBOL" CodeBehind="ShoppingCart.aspx.cbl"...
For example, if you wanted to bind the value of the ProductID object to the text property of a grid column you could use the following:
...
<ItemTemplate>
<asp:Label ID="ProductID" runat="server" Text='<%# super::"Eval"("ProductID") %>'></asp:Label>
</ItemTemplate>
' runat="server">
If you are using this type of code on a web page in an ASP.NET Web application then you will also have to update your .aspx to include Language="COBOL" on the page.
We don't specify the Language property by default so that aspx pages don't generate a reference to our CodeDom, so that it is not required on a deployment
machine unless absolutely necessary.
It is necessary for these pages, however, as they include COBOL code.
For example: Page AutoEventWireup="true" MasterPageFile="~/Site.master" Language="COBOL" CodeBehind="ShoppingCart.aspx.cbl"...
Old KB# 32704