Re: Checkbox data binding on Checked property

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thank you Phillip and Steven for your replies. It's comforting to know that
there is a reason why I couldn't get the Bind to work.

Take care.

Eric
"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:dddx6zHWGHA.4620@xxxxxxxxxxxxxxxxxxxxxxxx
Thanks for Phillip's input.

Hi Eric,

I think you need to use the "Eval" expression instead of the "Bind" since
"Bind" is used for two-way databinding and has limited functionalty. For
your scenario, you just need to use "Eval" to extract the column value and
compare it to convert it to boolean value. e.g;

<%# Eval("CategoryName").ToString() == "TestName"? true: false %>

Also, we can also define a helper function in page's code behind and call
the helperfunction in databinding expression to do th work. e.g;

<%# GetBool(Eval("CategoryName")) %><br />

========in code behind============
protected bool GetBool(object obj)
{
return obj.ToString() == "TestName" ? true : false;
}


Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no
rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



.



Relevant Pages

  • Re: Install Windows Patch via GPO
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windows.group_policy)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS-IS" with no warranties or guarantees and ... confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS-IS" with no warranties or guarantees and confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)
  • Re: Installing a 360 Media Center Extender
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windows.mediacenter)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)