datagrid query-binding problem

R

reiks

I have a datagrid with three template columns with
textboxes in my item template column.

My requiremnt is to bind data from the following query
SELECT sum(qty), count(qty)
FROM sales

to the datagrid

I used the following expression for my textbox:
<asp:TextBox id="Textbox8" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"sum(qty1)") %>'>
</asp:TextBox>

But I'm getting an error

How can I acheive this?

I'm getting the value correctly in my datatable.Then why
it's getting binded to datagird?
Cant the 'DataBinder.Eval()' work for aggregate functions?

How can we acheive this?
 
C

Chris Jackson

Try using:

SELECT sum(qty) as QtySum, count(qty) as QtyCount
FROM sales

Then, you can use Container.DataItem("QtySum")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top