Click here to Skip to main content
15,922,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
I have i structure like :

<gridview>
&lt;Label&gt;
<datalist>
</datalist>
</gridview>

and i want label value of gridview in ItemDatabound event of datalist
Posted

1 solution

C#
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var label = (e.Item.Parent.DataItemContainer as GridViewRow).FindControl("ID of label") as Label;
            }
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900