datagrid-expressions

  • Thread starter Thread starter reiks
  • Start date Start date
R

reiks

My select query is a s follows
select qty from sales;

My datagrid as two template columns with textboxex in
Item
template.I want to use second template column as a
compute column in my datagrid which
depends on column 'qty' values of my select statement

compute column's value should be as follows
if( qty > 10) qty+10 else
qty-10

How can give my 'DataBinder.eval(containder.dataitem))'
expression to my textbox in html?

How can I acheive this?I dont want to use a compute column
in my select statement?

How complex evaluation expressions can be given for
datagrid columns either at design time or programatically?

plzzz help me out

thanks in advance,
reiks
 
reiks said:
My select query is a s follows
select qty from sales;

My datagrid as two template columns with textboxex in
Item
template.I want to use second template column as a
compute column in my datagrid which
depends on column 'qty' values of my select statement

compute column's value should be as follows
if( qty > 10) qty+10 else
qty-10

How can give my 'DataBinder.eval(containder.dataitem))'
expression to my textbox in html?

How can I acheive this?I dont want to use a compute column
in my select statement?

How complex evaluation expressions can be given for
datagrid columns either at design time or programatically?

plzzz help me out

thanks in advance,
reiks

Just write a function for your expression and add it to the
databinding syntax:
Function myExpr(oQty As Object) As String
Dim qty As Integer=Convert.toInt32(oQty)
if(qty>10) Then
qty+=10
else
qty-=10
End If
End Function

This goes in your template:
Text='<%# myExpr(DataBinder.Eval(Container.DataItem,"myField")) %>'
 
Jos wrote:

Add the line

Return qty.ToString()

before End Function

to make it really work
 
Back
Top