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

Checking result of Container.DataItem in a Datagrid

Hi,

I would like to find out if it's possible to check the value of a
Container.DataItem inside the Datagrid's <ItemTemplate> tag .... based on
it's value, I would to either output it or output another DataItem from the
current resultset. Something like this:

<ItemTemplate>

If container.dataitem( "column" ) <> "none" Then
output container.dataitem( "column" )
Else
output container.dataitem( "alternate column" )

</ItemTemplate>

My weakness is inline asp code using <%# %> or <% %>. I jumped straight
into asp.net without knowing classic asp, and I think it's hurting me in
this case! Thanks for any advice.

Brian
Nov 18 '05 #1
1 2853
Not using inline code. You'd need to add a handler for the datagrid.ItemDataBound event and do your checking there

----- anony wrote: ----

Hi

I would like to find out if it's possible to check the value of
Container.DataItem inside the Datagrid's <ItemTemplate> tag .... based o
it's value, I would to either output it or output another DataItem from th
current resultset. Something like this

<ItemTemplate

If container.dataitem( "column" ) <> "none" The
output container.dataitem( "column"
Els
output container.dataitem( "alternate column"

</ItemTemplate

My weakness is inline asp code using <%# %> or <% %>. I jumped straigh
into asp.net without knowing classic asp, and I think it's hurting me i
this case! Thanks for any advice

Bria

Nov 18 '05 #2

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

Similar topics

2
by: az bij | last post by:
Hi, I have a dataset bound to a repeater and want to place some logic in my ascx file. I want to display an image link if and only if an image is available. I have tried without success...
1
by: Mike P | last post by:
I'm having trouble with C# syntax for Container.DataItem. This is the VB version. CAn anybody help me out with the syntax? <asp:DataList runat="server" id="dlResults" Font-Name="Verdana"...
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...
0
by: Earl Teigrob | last post by:
I have created a templated custom control that simply creates a spacing table around other objects. This control works fine for most uses but when I add it inside the ItemTemplate of a DataGrid...
4
by: Ben R. | last post by:
I was wondering if someone could give me some info on what this element acutally is... I've used it tons when definining a templated column in a datagrid within <%# %>, but don't really know where...
1
by: Vishal | last post by:
Hello, I have a datagrid and need to show a simple HTML button in a column. This button contains an OnClick event and looks like this: <code> .... <ItemTemplate> <input type="button"...
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 {...
2
by: Antony | last post by:
Hello, in my aspx.file I have this code inside a datagrid: <asp:TemplateColumn HeaderText="Picture"> <ItemTemplate> <asp:Image id="Image1" runat="server" ImageUrl='upload/<%#...
3
by: alberthung01 | last post by:
Hi all, I try to use Container.DataItem() in my DataGrid's ItemTemplate. Somewhere it works fine. eg.<input type=checkbox id='cb_select_<%# Container.DataItem("TAG_ID") %>' value='<%#...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...
0
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,...

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.