473,779 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bind() transform value problem

Hi everybody,

Is there a way to convert a value with Bind()? I have a decimal(5,4)
data that I retrieve from DB, which represents a percent. For example,
50% is represented as 0.5000. When I bind the data to a gridview, I'd
like to see this value as "50", because what I do is a templatefield :
<edititemtempla te>
<asp:textbox text='<%#Bind(" value")' runat="server" />
</edititemtemplat e>

But is there a way to format the field so it multiplies by a hundred
before binding to the textbox?

Thank you!

ibiza

Feb 1 '06 #1
7 2161
well, I have now Text='Bind("val ue", "{0:p}")'. which multiplies the
given value by 100, but also shows a % sign...in a textbox where you
enter the percent number, as % sign is unwelcome. Is there a way to
remove it?

thanks

Feb 1 '06 #2
When you say Bind() do you mean DataBinder.Eval (or simply Eval() in 2.0)??

If so, you can specify a 3rd parameter

DataBinder.Eval (Container.Data Item, "value", "{0:p}")

Karl

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

"ibiza" <la******@gmail .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi everybody,

Is there a way to convert a value with Bind()? I have a decimal(5,4)
data that I retrieve from DB, which represents a percent. For example,
50% is represented as 0.5000. When I bind the data to a gridview, I'd
like to see this value as "50", because what I do is a templatefield :
<edititemtempla te>
<asp:textbox text='<%#Bind(" value")' runat="server" />
</edititemtemplat e>

But is there a way to format the field so it multiplies by a hundred
before binding to the textbox?

Thank you!

ibiza

Feb 1 '06 #3
I am using asp.net 2.0, which means that Bind("value", "{0:p}") is the
same as DataBinder.Bind (Container.Data Item, "value", "{0:p}") in asp
1.x

thanks for your reply

ibiza

Feb 1 '06 #4
Ibiza Try using Replace function to remove it
Patrick

"ibiza" <la******@gmail .com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
well, I have now Text='Bind("val ue", "{0:p}")'. which multiplies the
given value by 100, but also shows a % sign...in a textbox where you
enter the percent number, as % sign is unwelcome. Is there a way to
remove it?

thanks

Feb 2 '06 #5
thanks Patrick.

hmmm but how can I use replace in a binding context? I mean,
Bind("value", "{0:p}") is in the aspx file (not in a class of function
full of VB.NET/C# code exclusively), embedded in a gridview
declaration. I tried Replace(Bind("v alue", "{0:p}") , " %", ""), but it
gives me an error. I guess it can't bind the data correctly anymore if
another function messes the process...

ibiza

Feb 2 '06 #6
Ibiza then do it in the codebehind
i'm sure you must be using a control
in short get the ID of that control whic will give you the "value" u need
and
do what you want to do..
Hope that helps
Patrick

"ibiza" <la******@gmail .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
thanks Patrick.

hmmm but how can I use replace in a binding context? I mean,
Bind("value", "{0:p}") is in the aspx file (not in a class of function
full of VB.NET/C# code exclusively), embedded in a gridview
declaration. I tried Replace(Bind("v alue", "{0:p}") , " %", ""), but it
gives me an error. I guess it can't bind the data correctly anymore if
another function messes the process...

ibiza

Feb 3 '06 #7
oookay...but where can I use Bind() and Eval() in code behind ? I
thought it was only in the declaration of a gridview...can you give me
a tiny example?

thanks a lot,

ibiza

Feb 3 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4678
by: Alex Vinokur | last post by:
Functor-parameters in the for_each() and transform() algorithms are passed by value. Might it make sense to have also algorithms for_each2() and transform2() which pass Functor-parameters by non-const reference? Here is some program which demonstrates probable necessity in such forms of for_each() and transform().
2
1024
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty well for simple transforms. But as soon as I add Xsl variables or For each loops to the XSL string in the db, it fails to transform the XML. I can see that it will transform everything until that point. ALso If I copy the XSL & XML I am trying to...
8
2176
by: Luther Miller | last post by:
I am using the XML tranform functionality in .NET to transform data in a DataSet into XMLSS using an XSLT file I have created. There are about 100 columns and only about 120 rows in the data table being transformed - modest amount of data to say the least. The transform takes at least 10 seconds on a fast machine, which seems absolutely ridiculous. The DataSet contains many other tables in addition to the one I am
6
2490
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process I've hit a snag. How do I resolve multiple external references? The transform method on a stylesheet only takes one resolver, not an array Stephen
3
1956
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number> subsitutes the position of the node correctly as I expected. This is fine with MSXML 3.0 & MSXML 4.0 plus the XmlSpy internal engine. I have been able to reproduce using a simpler Xml and Xsl to demonstrate; XML
6
1730
by: tcdevelopment | last post by:
I have a XSLT file that gives expected results when I transform using MSXML V4.0 in a simple vbs file. However when using XslTransform in dotnet, I do not get the same results. The part of the XSLT file that does not work correctly is: <Token TokenId="3129"> <xsl:for-each select="EDI/Segment/Element"> <Value Segment="PRF" Position="1"> <xsl:attribute name="SegmentIndex"> <xsl:value-of select="../@SegmentIndex"/></xsl:attribute>
3
2134
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty string. I expected the xml to be transformed into a plain text document. Everything works fine when i transform using XmlPad. Here's the code (which does generate the Xml properly): Sample XML:
3
6816
by: =?iso-8859-1?B?Tm9yZGz2dw==?= | last post by:
Hey there, C++ Coders! I am learning multi-threading with boost and have come up with the following code example shown below. This example implements a test of the producer-consumer design pattern. gcc-4.1.2 however complains with errors about my use of boost::bind(). Doesn't bind support this way of specifying a function and its arguments or should I solve it in another way?
3
11846
by: popprem | last post by:
hi, I validated my schema & xml in JAXP. its validated fine. I created the object model in JAXB using xjc command & wn i try to run run the program in throws javax.xml.bind.UnmarshalException: unexpected element{} exception. Can anyone please help me??? Thanks in advance. here are the schema & file <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" ...
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.