Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Itemtemplate

Status
Not open for further replies.

NeilV

Programmer
Oct 14, 2002
117
GB
Hello,

I am trying to fill in a cell in my datagrid in the following way:
<ItemTemplate>
<% if DataBinder.Eval(Container.DataItem, &quot;type&quot;)) = &quot;1&quot;) Then
GetTotal(DataBinder.Eval(Container.DataItem, &quot;type_of_expense&quot;), DataBinder.Eval(Container.DataItem, &quot;1&quot;), &quot;&quot;)
ElseIf (trim(DataBinder.Eval(Container.DataItem, &quot;type_of_expense&quot;)) = &quot;2&quot;))
Then
GetTotal(DataBinder.Eval(Container.DataItem, &quot;type_of_expense&quot;), DataBinder.Eval(Container.DataItem, &quot;2&quot;), &quot;&quot;)
Else
GetTotal(DataBinder.Eval(Container.DataItem, &quot;type_of_expense&quot;), DataBinder.Eval(Container.DataItem, &quot;Amount&quot;), &quot;&quot;)
End if

%>

But i get the following error:

BC30451: Name 'Container' is not declared

How can i fix this?

Neil
 
Try adding # to your <% where the code begins. and moving the dataitem to the quoted text.

[tt]<%# DataBinder.Eval(Container, &quot;DataItem.type&quot;)...[/tt]

I checked your syntax with the syntax on faq855-4372.

It also looks like you have an extra ) in the first line before the equal sign.
[tt]<% if DataBinder.Eval(Container.DataItem, &quot;type&quot;)) = &quot;1&quot;) Then[/tt]

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top