JohnCoderMan
JohnCoderMan

Reputation: 40

DataBinder.Eval Issue

I have a some controls inside an EditItemTemplate within a RadListView control:

 <telerik:RadComboBox ID="cbCategoryTypeTueET" runat="server" Skin="Office2010Black"
     SelectedValue='<%# DataBinder.Eval(Container.DataItem, "CategoryTypeID") %>'
     TabIndex="1" Width="100%" EmptyMessage="--Select Category Type--" DataSourceID="edsCatTypeTueET"
     DataTextField="CategoryName" DataValueField="CategoryTypeID" AutoPostBack="True"
     OnSelectedIndexChanged="cbCategoryTypeTueET_SelectedIndexChanged" AccessKey="t" AppendDataBoundItems="True">
</telerik:RadComboBox>
<asp:EntityDataSource ID="edsCatTypeTueET" runat="server" ConnectionString=""
     DefaultContainerName="ATITimeEntry" EnableFlattening="False" EntitySetName="TimeTrackingCategoryTypes"
     Select="it.[CategoryTypeID], it.[CategoryName]"
     Where="it.deletedFlag = false AND it.activeFlag = true" >
</asp:EntityDataSource>

The Entity datasource does have a connection string - I am using a new code generation template - so this is not an issue.

My problem is I want the combobox to bind on edit. But if activeFlag is false or deletedFlag is true (or both) the Radlistview will not go into edit mode. Is there an elegant way to do this with markup or some elegant query?

Upvotes: 0

Views: 174

Answers (1)

Cyril Iselin
Cyril Iselin

Reputation: 596

My understandig is, you want to forbid edit on some conditions.

You have to subscripe the ItemDataBound Event from the RadListView. There you can cast DataItem to your object and check the condition (Get Data being bound to ListView).

Then you can access your controls and manipulate them (like hide them)... Conditionaly disable command button

Upvotes: 0

Related Questions