Hi,
I could be wrong here as I've not had much experience with FindControl, but I think the problem is that it isn't finding the control. I think this is because you have placed it within an UpdatePanel and so the control cannot be found within the DataList?
Try FindControl within the UpdatePanel, rather than the datalist. From my understanding, FindControl will only work for that layer/panel and not its children, although I may be incorrect.
Try doing a DataList2.controls.count and see how many controls it returns.
It's only an idea, hope it helps.
The problem isn't related to the UpdatePanel.
You need to use FindControl on the particular row that the control you're after is on, not the entire DataList. For example, if you wanted to find a control in the first row of the DataList, you'd use DataList2.rows[0].FindControl("SqlDataSource9")
perhaps there is a row command in VB, but as far as I can see in C#, there is not rows property for the datalist.
Ahh, I think:
DataList2.Items[0].FindControl("SqlDataSource9")
No comments:
Post a Comment