Hello Everybody,

I have a ListView control and under ItemTemplate I have following code:

Code:
<asp:Label ID="Label1" runat="server" Text='<% #MatchCategory(dtCategories.Rows[i]["ID"].ToString().Trim(), Eval("CategoryID").ToString()) %>'></asp:Label>
The MatchCategory method just checks if two values are equal and return true or false. Just below this code I am separately printing dtCategories.Rows[i]["ID"].ToString().Trim() and Eval("CategoryID") and can see matching values but MatchCategory method always returns false.

Code:
<asp:LinkButton ID="lnkBtnClass" runat="server" OnClick="ShowClassPopup"><%# Eval("Name") %></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="ShowClassPopup"><% Response.Write(dtCategories.Rows[i]["ID"].ToString().Trim()); %></asp:LinkButton>
Here's my MatchCategory method.

Code:
public bool MatchCategory(string CategoryID1, string CategoryID2)
{
      if (CategoryID1.Trim() == CategoryID2.Trim())
            return true;
       else
             return false;
}
Any idea as to why I am always getting false?

Thanks.