473,569 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Dec rypt(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.Dec rypt(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.Dec rypt(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 2034
Hi there,
DataBinder.Eval returns an object. Apparently your MyComponent.Dec rypt
method takes a string which is why the compiler is complaining. I think
something like this should work:

myComponent.Dec rypt((string)Da taBinder.Eval(m yDataSet,
"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.Dec rypt(DataBinder .Eval(myDataSet ,"Tables[MyTable].DefaultView[0
].MyField","{0}" )). By adding the optional "StringForm at" arguement, it
would natively return a string.

I'll try both options out.

David

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

myComponent.Dec rypt((string)Da taBinder.Eval(m yDataSet,
"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
3808
by: Michelle Keys | last post by:
Subject: DataBinder.Eval Error! Server Error in '/MSPOS' Application. ------------------------------------------------------------------------ -------- DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a property with the name REPORTTO. Description: An unhandled exception occurred during the execution of the
5
724
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 (DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name date) <asp:DataGrid id="RssNewsGrid"
1
1765
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. # pretend code <% if DataBinder.Eval(Container.Item, "myDownloadFile) == String.Empty) { %> Now download file is available
1
2229
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 aren't fully separated. If you're displaying data in a DataGrid, is it appropriate to define a label in your template column as <asp:Label...
3
2256
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 { get; } }
3
2543
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 within the Repeater as RadioButtonLists. Simple enough I think. My data consists of a Question table and an Answer table. The Question table has...
4
7337
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 use this quite inelegant OO code wrapped in #<% %> inside the markup? secondly: sometimes you see simliar code inside the markup without calls to
3
3390
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 above line, so that I can manipulate it: I tried string resultText = DataBinder.Eval(Container.DataItem, "characterization");
14
2004
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 not traceable exception triggered and the all binding is stopped. But this same named skinid is working for hyperlinks outside templates.
0
7700
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...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
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...
0
6284
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...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.