Shah
Shah

Reputation: 1654

How to show a conditional checkbox in DataList

I need to show a checkbox in the DataList if a particular column in the binded Data Source is having a particular value.

Means look for a particular value. if exist then show checkbox else dont show.

Upvotes: 0

Views: 420

Answers (2)

Divi
Divi

Reputation: 7701

You can do something like this in your aspx page:

<% if(valueToCheck == columnValue) {%>
<add checkbox here>
<% } %>

I haven't tried this, but it gives you the basic idea

Upvotes: 0

IUnknown
IUnknown

Reputation: 22468

Handle the DataList.ItemDataBound event to get checkbox control and set Visible to false or hide with display:none style when it doesn't needed.

Upvotes: 1

Related Questions