Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:11:56+00:00 2026-06-02T16:11:56+00:00

I am trying to do this in a repeater: <%# Iif((int)DataBinder.Eval(Container.DataItem, Id) == SelectedJobDefId,

  • 0

I am trying to do this in a repeater:

<%# Iif((int)DataBinder.Eval(Container.DataItem, "Id") == SelectedJobDefId, "blue", "red")%>

Problem is that the member property only evaluates if this syntax is used:

<%= SelectedJobDefId %>

DataBinder.Eval() only works if the hash symbol is used.

As a test, I tried this:

  <%= SelectedJobDefId %>
  <%# DataBinder.Eval(Container.DataItem, "Id") + " " + SelectedJobDefId %>

The first SelectedJobDefId stays correct as I switch rows (LinkButton event).
The DataBinder part is correct for each row.
The 2nd output of SelectedJobDefId is always “1”.

How can I compare these two values?

UPDATE:

Based on the suggestion by Jeremy, I made the td a server tag and tried to do the logic in OnItemDataBound like this:

protected void Repeater2_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;
        DataRowView drv = (DataRowView)item.DataItem;

        int id = (int)drv.Row.ItemArray[0];

        HtmlTableCell td = (HtmlTableCell)item.FindControl("failtd");

        if (id == this.SelectedJobDefId){td.BgColor = "green";}
    }

When I step through the debugger, the OnItemDataBound event is happening before the LinkButton event that updates the SelectedJobDefId property which explains the default value of 1.

Is there a way to switch the order of events? I may just be taking the wrong approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:11:57+00:00Added an answer on June 2, 2026 at 4:11 pm

    Just putting this out there as an option, though obviously not most efficient approach.

    You could explicitly rebind the Repeater in the LinkButton click handler, after SelectedJobDefId has been updated. In this way, you should be able to keep all the aspx markup you originally had.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying this: {:id => 5, :foos => [1,2,3]}.each {|k,v| v.to_s} But that's returning
Right now I'm trying this: int a = round(n); where n is a double
I am trying to create nested repeaters dynamically using ITemplate. This repeater is like
I'm trying to get this working but no success: <asp:Repeater ID=Repeater1 runat=server OnItemCommand=btnDeleteFamily_Click> <HeaderTemplate>
I'm trying to build an ASP.net user control that uses a Repeater to iterate
I have a repeater that creates n-number of panels. I am trying to dynamically
I am trying to bind a datatable to a repeater. To do this, according
I've got a xml file that looks like this and I'm trying to get
What i'm trying to do is this <asp:Repeater ID=ParentRepeater runat=server OnItemDataBound=ItemBound> <ItemTemplate> <asp:Repeater ID=Repeater_SideMenu_Guides_Medlem
I am trying to use the Search Box that is explained in this blog

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.