Detecting if ListViewItem or ListViewDataItem
Posted on 2011-09-15
I have a Web User Control with a DropDownList and i have a parent page with a ListView which contains the Web User Control in the InsertItem and in the EditItem
And when i use the SelectedIndexChanged and use the sender object to tell where the Control Was sent from
DropDownList DropDownList1 = (DropDownList)sender;
I then assign it to the LIistViewDataItem
ListViewDataItem ListView1 = (ListViewDataItem)DropDownList1.Parent.Parent;
If the DropDownList is being executed in the InsertItem of the ListView then it is coming through as ListViewItem but if it is being Executed in the EditItem It is coming thorgh as a ListViewDataItem
So this is where i'm getting an error and i need a way to test which one is coming through.
Sort of Like
If (lvAssets.Item == ListViewDataItem)
else if (lvAssets.Item == ListViewItem)
Is this Possible?