Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Databindings property - I want to disable true values rather than false values

Reply
Thread Tools

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

 
 
Steve
Guest
Posts: n/a
 
      01-27-2006
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?

 
Reply With Quote
 
 
 
 
Karl Seguin [MVP]
Guest
Posts: n/a
 
      01-27-2006
have you tried simply negating the value?

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

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

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



"Steve" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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?
>



 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      01-27-2006
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!

 
Reply With Quote
 
Karl Seguin [MVP]
Guest
Posts: n/a
 
      01-27-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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!
>



 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      01-27-2006
Thanks Karl, I'll check out your site to figure it out.

Thank you.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[False,True] and [True,True] --> [True, True]????? bdb112 Python 45 04-29-2009 02:35 AM
debug="false" in web.config and <%@ debug="true" ...%> in aspx file => true or false? André ASP .Net 3 08-28-2006 12:02 PM
False positive, false intrusion, false alarm Nick Computer Security 3 04-26-2006 07:40 PM
Label Databindings are reset upon edit databindings via smart tag =?Utf-8?B?UFc=?= ASP .Net 0 04-23-2006 11:10 PM
CrystalReportViewer 9 "Use the ReportSource or DataBindings property to specify a report" - HELP!!! Aaron Ackerman ASP .Net 1 02-16-2004 03:51 PM



Advertisments