datagrid query-binding problem

  • Thread starter Thread starter reiks
  • Start date Start date
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?
 
Try using:

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

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