This is a migrated thread and some comments may be shown as answers.

Eval issues

4 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 08 Aug 2008, 02:49 PM
I am currently using a grid with a template column on the main level and a detail table with 1 template column and 2 databound columns.

In the main level of the grid, I did 'Eval("Item")'. I tried to do the same in the detail table but it won't appear. If I put the literal "Text" instead of Eval it appears. If I put both nothing shows. I doubled checked to make sure my data was valid and it is.

Is this an issue with the grid? my setup? do I need to use a different form of Eval in my template column?

I am stumped at the moment to what I should do. Any ideas or help is appreciated.

4 Answers, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 2
answered on 08 Aug 2008, 06:18 PM
Try using two-way data binding using Bind instead of Eval which is one-way.
0
Karl
Top achievements
Rank 1
answered on 08 Aug 2008, 07:05 PM
I tried switching to Bind instead of Eval and I get the following error message::
"The name 'Bind' does not exist in the current context"
0
Sean
Top achievements
Rank 2
answered on 09 Aug 2008, 03:39 AM
Can you post the html? It my be that you are trying to Bind a string to an interger or vice versa. There are documented issues with the use of "" and '' in wrapping your html.

For example:

<asp:TextBox Runat="server" ID="TheNotes"   
     Text='<%# Bind("notes") %>' /> 

Where you will note the ' on the outside and " around the Bind variable.
Anyway, some sample code would help.

Thanks for listening!

Sean
Electronic Arts, Orlando FL

PS: http://msdn.microsoft.com/en-us/library/ms178366(VS.80).aspx
0
Karl
Top achievements
Rank 1
answered on 11 Aug 2008, 01:49 PM

My code was simply:

<div>  
    <%# FormatRate(Eval("ItemPrice"), Eval("IsEarlyBirdRate"), Eval("IsStandardRate"), Eval("IsLateRate"))%>  
</div> 

Since I needed to get my work done as soon as possible I have changed how I am doing the above code (which was inside a template column).

I am manipulating my data inside the ItemDataBound event which seems to be working exactly the same.

Still have been unable to use Eval in a DetailTable.
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Bruno
Top achievements
Rank 2
Karl
Top achievements
Rank 1
Sean
Top achievements
Rank 2
Share this question
or