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

2 posts, 0 answers
  1. Paul
    Paul avatar
    55 posts
    Member since:
    Nov 2010

    Posted 03 Feb 2011 Link to this post

    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


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

  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 09 Feb 2011 Link to this post

    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:

    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.
Back to Top