By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,948 Members | 1,929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,948 IT Pros & Developers. It's quick & easy.

ItemCreated event problem

P: n/a
All I want to do is change the border of the first img control in my html to
0. The other images I want to have border=1. I have an event on my datalist
that calls the following code:

**************

public void main_ItemCreated(Object sender, DataListItemEventArgs e) {
if (e.Item.ItemType == ListItemType.Item) {
HtmlImage imgPatron = new HtmlImage();
imgPatron = (HtmlImage)e.Item.FindControl(Request.Form["patron"]);
if(imgPatron!=null) {
image_count();
if(i_count == 1) {
imgPatron.Border = 0; }
}
}
}

************

When the program runs, the program throws the error "object reference not
set to an instance of an object". I'm kind of new to c#, can anyone tell me
what the problem might be?
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.