newbie: e.Item.DataItem = null

J

Jeff

hey

asp.net 2.0

my code crashes in the ItemDataBound event on my webpage.

my webpage has a ObjectDataSource (odsMessage), here are the settings I've
set in it's properties:
SelectMethod = getTestData
TypeName = testLogic.networkLogic
SelectParameters = I specified 2 parameters

This objectdatasource is the datasource to my Repeater control :
protected void Page_Load(object sender, EventArgs e) {
rptMessage.DataBind();
}

I've debugged the code and the getTestData method gets the correct
parameters and this method returns the correct value, but in the
ItemDataBound event the e.Item.DataBound is null....

Any suggestions to what is wrong here?

Jeff
 
J

Jeff

Thanks, I had forgotten that!

I'm very thankful for your tip!

jeff


Eliyahu Goldin said:
Do you filter out non-data item such as header, footer, separator?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Jeff said:
hey

asp.net 2.0

my code crashes in the ItemDataBound event on my webpage.

my webpage has a ObjectDataSource (odsMessage), here are the settings
I've
set in it's properties:
SelectMethod = getTestData
TypeName = testLogic.networkLogic
SelectParameters = I specified 2 parameters

This objectdatasource is the datasource to my Repeater control :
protected void Page_Load(object sender, EventArgs e) {
rptMessage.DataBind();
}

I've debugged the code and the getTestData method gets the correct
parameters and this method returns the correct value, but in the
ItemDataBound event the e.Item.DataBound is null....

Any suggestions to what is wrong here?

Jeff
 
K

Karl Seguin [MVP]

Are you checking e.Item.ItemType?

when it's Header/Footer, e.Item.DataItem will be null - because no items are
bound to the header/footer. you need to make sure that you are processing an
Item or AltnernativeItem row.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top