Re: Checkbox data binding on Checked property
- From: "Eric A. Miller" <EricUPMC@xxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Apr 2006 07:24:43 -0400
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.)
.
- Follow-Ups:
- Re: Checkbox data binding on Checked property
- From: Elroyskimms
- Re: Checkbox data binding on Checked property
- References:
- Checkbox data binding on Checked property
- From: Eric A. Miller
- RE: Checkbox data binding on Checked property
- From: Steven Cheng[MSFT]
- Checkbox data binding on Checked property
- Prev by Date: GridView Update Problem
- Next by Date: Re: Dropdown control that displays images rather than ...
- Previous by thread: RE: Checkbox data binding on Checked property
- Next by thread: Re: Checkbox data binding on Checked property
- Index(es):
Relevant Pages
|