简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM