By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Databindings property - I want to disable true values rather than false values

P: n/a
As you know there is a databindings property 'Enabled' for fields in
the gridview.

In the custom binding section I have used the expression:
Eval("myfield"). 'myfield' is a boolean field I have in my database.

This (obviously) leads to all 'False' fields being disabled and 'True'
ones being enabled.

What expression can I used instead of Eval("myfield") for the 'Enabled'
databindings property to make all 'True' values disabled and all
'False' values enabled?

Jan 27 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
have you tried simply negating the value?

vb.net:
<%# not eval("myField") %>

C#
<%# ! Eval("MyField") %>

Karl
--
http://www.openmymind.net/

"Steve" <ba****@iranmania.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
As you know there is a databindings property 'Enabled' for fields in
the gridview.

In the custom binding section I have used the expression:
Eval("myfield"). 'myfield' is a boolean field I have in my database.

This (obviously) leads to all 'False' fields being disabled and 'True'
ones being enabled.

What expression can I used instead of Eval("myfield") for the 'Enabled'
databindings property to make all 'True' values disabled and all
'False' values enabled?

Jan 27 '06 #2

P: n/a
Karl, Thank a lot!

That did it! Sorry I couldn't figure that out.

So I guess I can use any valid vb/c expression? Even if statments?

Thank you very much!

Jan 27 '06 #3

P: n/a
Yes, but as things get more complicated, you end up better off calling a
function that resides in your
codebehind, or hooking into the ItemDataBound event.

Both methods are documented:
http://openmymind.net/index.aspx?documentId=8#4

Karl
--
http://www.openmymind.net/

"Steve" <ba****@iranmania.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Karl, Thank a lot!

That did it! Sorry I couldn't figure that out.

So I guess I can use any valid vb/c expression? Even if statments?

Thank you very much!

Jan 27 '06 #4

P: n/a
Thanks Karl, I'll check out your site to figure it out.

Thank you.

Jan 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.