ashish007 says:
if
(e.CommandName ==
"ReplyComment"
)
{
DataListItem item = (DataListItem)(((Button)(e.CommandSource)).NamingContainer);
if
(e.Item.ItemType == ListItemType.Item)
{
DataRowView drv = e.Item.DataItem
as
DataRowView;
DataList DATALISTREPLYCHILD = item.FindControl(
"dlchildcomment"
)
as
DataList;
Image imprnt = item.FindControl(
"Image_parent"
)
as
Image;
You can't find the Image_parent from dl1 DataListItem.
Image_parent is present dlchildcomment DataList.
To find the image you need to use the DATALISTREPLYCHILD.
But before finding image you need to bind the DATALISTREPLYCHILD DataList.
After that use below code to find the image control with 1st index.
Image imprnt = DATALISTREPLYCHILD.Items[0].FindControl("Image_parent") as Image;
Or loop through the DATALISTREPLYCHILD DataList items to find the Image control.