473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataBinder.Eval question

I have a control on my webform that I am binding to a dataset. The issue
is, the field value in the dataset is encrypted and I am trying to decrypt
it during the binding process:

Example:

<asp:Lable ID="myLable Text='<%#
myComponent.Decrypt(DataBinder.Eval(myDataSet,
"Tables[MyTable].DefaultView.[0].MyField")) '></asp:Label>

This fails with the message : Compiler Error Message: CS1502: The best
overloaded method match for MyComponent.Decrypt(string)' has some invalid
arguments.

From what I've read, the DataBinder.Eval() does return a string value?

I can tell the decryption component works, because if I use the following in
my code behind:

myLable.Text = MyComponent.Decrypt(myDataSet.MyTable[0].MyField)

The decryption works and the data is displayed as desired.

Is it possible to do what I'm attempting? or, Should I simply give up and
use the code behind method?

I'd like to get this working, because I have other controls that I would
like to do some formatting on before I display on the web form.

David
Nov 18 '05 #1
2 2018
Hi there,
DataBinder.Eval returns an object. Apparently your MyComponent.Decrypt
method takes a string which is why the compiler is complaining. I think
something like this should work:

myComponent.Decrypt((string)DataBinder.Eval(myData Set,
"Tables[MyTable].DefaultView.[0].MyField"))
--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers
Nov 18 '05 #2
You're right, I was looking at the wrong overloaded method.

object DataBinder.Eval(object, string);
vs.
string DataBinder.Eval(object, string, string)

It appears as though I could use
myComponent.Decrypt(DataBinder.Eval(myDataSet,"Tab les[MyTable].DefaultView[0
].MyField","{0}")). By adding the optional "StringFormat" arguement, it
would natively return a string.

I'll try both options out.

David

"Milan Negovan" <sa***@northpole.net> wrote in message
news:Mg**********************@news4.srv.hcvlny.cv. net...
Hi there,
DataBinder.Eval returns an object. Apparently your MyComponent.Decrypt
method takes a string which is why the compiler is complaining. I think
something like this should work:

myComponent.Decrypt((string)DataBinder.Eval(myData Set,
"Tables[MyTable].DefaultView.[0].MyField"))
--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers

Nov 18 '05 #3

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

Similar topics

0
by: Michelle Keys | last post by:
Subject: DataBinder.Eval Error! Server Error in '/MSPOS' Application. ------------------------------------------------------------------------ -------- DataBinder.Eval:...
5
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
1
by: Chris | last post by:
Hey Okay using DataBinder.Eval in a repeater. My question is this - if the value is empy, eg the myDownloadFile is empty, how can i display different output than if it was populated. #...
1
by: Mike Lerch | last post by:
Pretty much, TSIA, but I'll expand a bit: I'm still trying to get my head around the n-tier approach to web design. It seems to me that when you use DataBinder.Eval in the ASPX that your tiers...
3
by: Eric Newton | last post by:
Given databinding an array of System.Version types: Given that "SomeObject" type has a Version property: public class SomeObject { public Version Version { get; } public string Description {...
3
by: Mark Jones | last post by:
I am quite new to ASP and .Net development and I am building a web-based multiple choice exam application. The web page displays the questions using a Repeater control and the answers are nested...
4
by: CharlesA | last post by:
a general question... I'm a bit mystified by Databinder.eval(object, Colname, ) if controls can be bound to their individual data sources within the load event of the page... why would we ever...
3
by: Kevin Blount | last post by:
In a DataList, I'm using the following: <%# DataBinder.Eval(Container.DataItem, "characterization")%> I was wondering if it's possible to create a string that would contain the value of the...
14
by: WT | last post by:
Hello, I have a usercontrol loaded in a page with a theme. This usercontrol contains columns template with hyperlinks, with skinID. The columns are not displayed, seems thta there is some...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.