Bengi Besceli
Bengi Besceli

Reputation: 3748

How to get the parent Datalist's row ID

I have a nested Datalist.
I'm trying to get the parent Datalist's ID. To do this I'm using ItemDataBound on parent Datalist. This line gets the parent Datalist object's row ID
but I'm trying to get the table row's ID which is on the table.
How can I do this?

protected void DataListMenu_ItemDataBound(object sender, DataListItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
        var innerDL = e.Item.FindControl("DataListSubMenu") as DataList;
        if (innerDL != null)
        {
            string ID = (e.Item.ItemIndex).ToString();
        }
    }
}

Upvotes: 0

Views: 177

Answers (0)

Related Questions