ItemCreated event problem

G

Guest

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?
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top