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

General question how to set control.visible in listView and calculate column in sql

1 Answer 58 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 03 Feb 2011, 01:59 PM
Any help with this problem would be appreciated (it isn't really Telerik specific)

I have a RadListView with an sqlDataSource. I have two problems. First I want to calculate a column in the sqldatasource. I have a table with a column called Owner and want to create a bool which indicates whether the present user is the owner of that record. ie

Select *, (Owner=@User) as mine where....

But this doesn't work so how can you calculate a columnwithin a select statement?

Second problem which is more related to the Rad control is that I am using an itemTemplate in the listView and would like to have a button within that template where I control the "visible" based on the value of the calculated column ("mine"). I have tried

Visible='<%#Eval("mine")%>'

but get a cast error (to avoid the first problem I have just calculated mine as 'true' in the datasource).

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 09 Feb 2011, 10:25 AM
Hi Paul,

I suggest that you handle the RadListView ItemDataBound event. There for the current item bound you can see if its Owner is equal to the logged user and based on that implement your logic.

Regarding the second question: You can again use the ItemDataBound event as mentioned above.

For more information on accessing the controls in a RadListView, check the below article:
http://www.telerik.com/help/aspnet-ajax/accessing-controls-in-radlistview.html

Regards,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ListView
Asked by
Paul
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or