473,394 Members | 1,699 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,394 software developers and data experts.

Checking Bind Value in ASPX

Hello,

In C#, We can read data fields from DB with <%#
DataBinder.Eval(Container.DateItem,"field_name") %>
but,
How can I check a value from DB with a <%# .. %> segment such as

<%# If( <condition> , <true_part> , <false_part>) %> ?

thanks...
Nov 19 '05 #1
4 1563
Emre:
Take a look at http://openmymind.net/databinding/index.html#4 it talks
about how to format when databinding. Two options are to use inline (basic)
and the ItemDataBound event (good for more advanced control)

For example of inline, you could just do:

<%# SomeFunction(DataBinder.Eval(Container.DataItem, "Something")) %>

where SomeFunction is a function you can declare is codebehind and works
like any other function (in this case it expect 1 parameter). Take a look
at the tutorial (atleast that specific part, all would probably be useful
though). Should answer your questions.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Emre Guldogan" <ask me please...> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
Hello,

In C#, We can read data fields from DB with <%#
DataBinder.Eval(Container.DateItem,"field_name") %>
but,
How can I check a value from DB with a <%# .. %> segment such as

<%# If( <condition> , <true_part> , <false_part>) %> ?

thanks...

Nov 19 '05 #2
Thanks Karl.
Nov 19 '05 #3
hoz
does this code decrease performance/ speed ?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:#j**************@TK2MSFTNGP10.phx.gbl...
Emre:
Take a look at http://openmymind.net/databinding/index.html#4 it talks
about how to format when databinding. Two options are to use inline (basic) and the ItemDataBound event (good for more advanced control)

For example of inline, you could just do:

<%# SomeFunction(DataBinder.Eval(Container.DataItem, "Something")) %>

where SomeFunction is a function you can declare is codebehind and works
like any other function (in this case it expect 1 parameter). Take a look
at the tutorial (atleast that specific part, all would probably be useful
though). Should answer your questions.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Emre Guldogan" <ask me please...> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
Hello,

In C#, We can read data fields from DB with <%#
DataBinder.Eval(Container.DateItem,"field_name") %>
but,
How can I check a value from DB with a <%# .. %> segment such as

<%# If( <condition> , <true_part> , <false_part>) %> ?

thanks...


Nov 19 '05 #4
Hoz:
If you want to do processing, you have no choice but to do it. Obviously
simply outputing it is better, like <%# Databinder.Eval(Container.DataItem,
"Something") %> but if you need to check the value and do stuff based on
the results, you really don't have a choice but to take the hit. There will
be a performance hit, but it's minor, and as i've said, you really don't
have any choice.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"hoz" <as*@me.com> wrote in message
news:uJ**************@TK2MSFTNGP15.phx.gbl...
does this code decrease performance/ speed ?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:#j**************@TK2MSFTNGP10.phx.gbl...
Emre:
Take a look at http://openmymind.net/databinding/index.html#4 it talks
about how to format when databinding. Two options are to use inline

(basic)
and the ItemDataBound event (good for more advanced control)

For example of inline, you could just do:

<%# SomeFunction(DataBinder.Eval(Container.DataItem, "Something")) %>

where SomeFunction is a function you can declare is codebehind and works
like any other function (in this case it expect 1 parameter). Take a look at the tutorial (atleast that specific part, all would probably be useful though). Should answer your questions.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Emre Guldogan" <ask me please...> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...
Hello,

In C#, We can read data fields from DB with <%#
DataBinder.Eval(Container.DateItem,"field_name") %>
but,
How can I check a value from DB with a <%# .. %> segment such as

<%# If( <condition> , <true_part> , <false_part>) %> ?

thanks...



Nov 19 '05 #5

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

Similar topics

0
by: Lucifer | last post by:
Hi I have some code for checking for cookies, that sets a cookie on page1 and checks for it on page2. and its based on the code by MS: ...
3
by: Moe Sizlak | last post by:
Hi, Can I check a checkbox by default based on the value returned from a database? for example if the value (dr("frm7value")) returned from a db field is "YES" how can I check the checkbox by...
1
by: Bob | last post by:
Is there a way to bind an XmlDocument object (or XmlNodeList) directly to a DropDownList in the code behind? I know it can probably be done using DataBinder to specify the items in the aspx but I...
5
by: Steven | last post by:
I'm using C# as code-behind for my aspx pages. How can I bind pages.. so that both the pages can use the functions, variables, controls .. between each other. eg., if I declare function scope()...
7
by: ibiza | last post by:
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...
3
by: sck10 | last post by:
Hello, I am trying to bind an arraylist to a FormView DropDownList control in the PreRender state. The error that I get is the following: Databinding methods such as Eval(), XPath(), and...
1
by: David C | last post by:
I have a DataList that displays photos and is bound to a list of files. Is there a way to combine the value of a variable (strpath) with the # Bind(...) in the ImageURL field. Below is what I...
1
by: sweatha | last post by:
Hi Friends I have designed a form with 1 DropDownList box named “ddlShow_time”& the form name is “Default4.aspx”. Just like that, I have the database(SQL SERVER 2000) as Table Name: ShowTime...
2
by: akshalika | last post by:
Hi, I have a repeater control. it dynamically bind textbox or dropdown base on some condition. i want to bind required field validator dynamically for validate textbox or dropdown. here is my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.