I tried:
<option value="<%# Eval("DataID")%>" selected="(<%# Eval("NewID")%>==<%# Eval("DataID")%>)?'selected':''"> <%# Eval("ColorName")%></option>
but output i am getting(inspect element)
<option value="13047" selected="(13050==13047)?'selected':''"> ..BLACK</option>
<option value="13048" selected="(13050==13048)?'selected':''"> .CHARCOAL</option>
<option value="13049" selected="(13050==13049)?'selected':''"> BANANA</option>
Is there any other way to use conditional operator or If condition in Repeater
Try this:
selected='<%# Eval("NewID").ToString() == Eval("DataID").ToString() ? "selected" : "" %>'
EDIT:
Well, my html is a bit rusty :=) Although the above code is syntactically correct it will not produce the desired result, i.e. to get the specified option
selected. Sth like this is most probably what the OP wants to achieve:
<option value='<%# Eval("DataID")%>' '<%# Eval("NewID").ToString() == Eval("DataID").ToString() ? "selected" : "" %>'>