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

ItemDataBound event woes...

Roy
Hey all,
This is a fairly broad question, but why is it that my datagrid hits
the ItemDataBound event 3 times?

Basically, I placed a response.write in all sub and functions in my
codebehind and discovered that my page_load,prerender,and binddata subs
all get called once, but my itemdatabound event gets called 3 times.
What's weird is that there is only 1 row being pushed into the
datagrid, so I should only be seeing one itemdatabound call, right?
Certainly not 3...

On a hunch, I'm thinking that somehow the 3 calls represent the
datagrid header, content, and footer... Am I misunderstanding this?

Nov 19 '05 #1
1 1553
Hi Roy,

In ItemDataBound event all items (including ListItemType.Item,
ListItemType.Header, and ListItemType.Footer) are processed. In order to
avoid process header and Footer, you can code like

if (e.Item.ItemType == ListItemType.Item || ListItemType.Item ==
ListItemType.AlternatingItem)
{
// process
}

HTH

Elton Wang
el********@hotmail.com

"Roy" wrote:
Hey all,
This is a fairly broad question, but why is it that my datagrid hits
the ItemDataBound event 3 times?

Basically, I placed a response.write in all sub and functions in my
codebehind and discovered that my page_load,prerender,and binddata subs
all get called once, but my itemdatabound event gets called 3 times.
What's weird is that there is only 1 row being pushed into the
datagrid, so I should only be seeing one itemdatabound call, right?
Certainly not 3...

On a hunch, I'm thinking that somehow the 3 calls represent the
datagrid header, content, and footer... Am I misunderstanding this?

Nov 19 '05 #2

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

Similar topics

2
by: Steve Klett | last post by:
Hi- I am developing a hierarchical navigation system. I have a DataList with the root level items, on the ItemDataBound event, I check for the selected item, when found I'm adding an additional...
3
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am...
4
by: Girish | last post by:
Im trying to create a grid within a grid programmatically. Ive been successful in doing this but I need the embedded grid to fire its ItemDataBound event so I can handle it. The event does not seem...
1
by: needin4mation | last post by:
Hi, I have a datalist. In this datalist I have a datagrid. The datalist is the master. The datagrid is the detail. It works fine. I populate the datagrid inside of the datalist using the...
3
by: Jon | last post by:
Hello everyone, We're using ASP.net 1.1 and when we load a control dynamically, using LoadControl, the ItemDataBound of the DataGrid that sits in this dynamically loaded control does not get...
1
by: greenb | last post by:
I'm using the ItemDataBound event of the DataGrid to highlight cells that are outside an acceptable range. Each row has a button column (CommandName='Select'), that is used to display addtional...
5
by: Nathan Sokalski | last post by:
I have a control that I want displayed in all items except the last one. I figured the best way to do this was to determine whether the current item was the last from within the ItemDataBound event...
2
by: Nathan Sokalski | last post by:
I have a DataList control that I use the ItemDataBound event for. One of the properties of the DataList that I use in this event is Me.datMain.Items.Count (datMain is the id of my DataList) in...
1
by: Nathan Sokalski | last post by:
I am trying to set the CommandArgument property of a Button control from a template in a DataList of mine using code in the ItemDataBound event. However, it does not want to set the property (it is...
1
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...
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.