473,660 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataBinder question

In a DataList, I'm using the following:

<%# DataBinder.Eval (Container.Data Item, "characterizati on")%>

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.Data Item, "characterizati on");

....but I get an error saying "Container" does not exist in the current
context.

Any advise on how to get the value of "characterizati on" into "resultText "?
Nov 22 '06 #1
3 3393
An easy way to manipulate it is to pass it to a function. You could put a
function in the code behind :
public string DoStringWord(st ring characterizatio n){
return characterizatio n; //Do something here
}

and in the page put:
<%# DoStringWord(Da taBinder.Eval(C ontainer.DataIt em, "characterizati on")) %>
Give it a go.

Ciaran O'Donnell
http://wannabedeveloper.spaces.live.com

"Kevin Blount" wrote:
In a DataList, I'm using the following:

<%# DataBinder.Eval (Container.Data Item, "characterizati on")%>

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.Data Item, "characterizati on");

....but I get an error saying "Container" does not exist in the current
context.

Any advise on how to get the value of "characterizati on" into "resultText "?
Nov 22 '06 #2
Hi Ciaran,

I gave that a try, but had to make a small modification. The method
(DoStringWord) was expecting a string. Once I figured that out, and
added .ToString() at the end of the call, your script worked wonderfully!

<%# DoStringWord(Da taBinder.Eval(C ontainer.DataIt em,
"characterizati on").ToString() ) %>

Thanks for the reply and the answer :)

Kevin

Ciaran O''Donnell wrote:
An easy way to manipulate it is to pass it to a function. You could put a
function in the code behind :
public string DoStringWord(st ring characterizatio n){
return characterizatio n; //Do something here
}

and in the page put:
<%# DoStringWord(Da taBinder.Eval(C ontainer.DataIt em, "characterizati on")) %>
Give it a go.

Ciaran O'Donnell
http://wannabedeveloper.spaces.live.com

"Kevin Blount" wrote:
>In a DataList, I'm using the following:

<%# DataBinder.Eval (Container.Data Item, "characterizati on")%>

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.Data Item, "characterizati on");

....but I get an error saying "Container" does not exist in the current
context.

Any advise on how to get the value of "characterizati on" into "resultText "?
Nov 22 '06 #3
Hi Ciaran,

I gave that a try, but had to make a small modification. The method
(DoStringWord) was expecting a string. Once I figured that out, and
added .ToString() at the end of the call, your script worked wonderfully!

<%# DoStringWord(Da taBinder.Eval(C ontainer.DataIt em,
"characterizati on").ToString() ) %>

Thanks for the reply and the answer :)

Kevin

Ciaran O''Donnell wrote:
An easy way to manipulate it is to pass it to a function. You could put a
function in the code behind :
public string DoStringWord(st ring characterizatio n){
return characterizatio n; //Do something here
}

and in the page put:
<%# DoStringWord(Da taBinder.Eval(C ontainer.DataIt em, "characterizati on")) %>
Give it a go.

Ciaran O'Donnell
http://wannabedeveloper.spaces.live.com

"Kevin Blount" wrote:
>In a DataList, I'm using the following:

<%# DataBinder.Eval (Container.Data Item, "characterizati on")%>

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.Data Item, "characterizati on");

....but I get an error saying "Container" does not exist in the current
context.

Any advise on how to get the value of "characterizati on" into "resultText "?
Nov 22 '06 #4

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

Similar topics

0
3810
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
2
2039
by: dm_dal | last post by:
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.DefaultView..MyField")) '></asp:Label>
1
1770
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
2
1275
by: George Durzi | last post by:
Here's my asp:Repeater <asp:Repeater ID="rptHelpDeskSystemStatus" Runat="server"> <HeaderTemplate> <table width="100%" border="0" class="datatable"> <tr class="item"> </HeaderTemplate> <ItemTemplate> <td align="center"> <asp:Label ID="lblService" Runat="server" Text='<%#
4
1684
by: Pierre Shirvan | last post by:
I have a form with a DataList control with a label control and a text control in the ItemTemplate section. I can display the data in the text contol using the DataBinder.Eval method and I also want to display the Field or the Column title in the Label control. How can I retrieve the column (field) name from the Container? TIA
3
2548
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 a QuestionID and a Question field. The Answer table has a AnswerID field, an Answer field and a...
4
7339
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
1182
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
2007
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
8428
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
8341
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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...
0
8754
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
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...
1
6181
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
5650
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
4177
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
1740
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.