So I have this application where I'm trying to create a notification panel
which will display some data (which will be handled by a datasource
based on an object
) in a datarepeater
. However some of these notifications need to behave different than others. For example a missed message notification needs 3 buttons
(ignore,respond,delete) while a software version notification would only need 2 (ignore,delete). Is there any way to do this with the datarepeater
or should I just create a different datasource
and datarepeater
for each type of notification
Asked
Active
Viewed 34 times
0

Vishvadeep singh
- 1,624
- 1
- 19
- 31

Luc Damhuis
- 31
- 6
-
show some stuff(code snippet) as per your requirement. – Vishvadeep singh Oct 03 '18 at 10:25
1 Answers
0
I have a data repeater and use the data binding event (Button1_DataBinding)
and then use:
((GridViewRow)((Control)sender).Parent.Parent)
to get to the gridview
row, you can then expand that to look at the datarow in question:
((DataRowView)((GridViewRow)((Control)sender).Parent.Parent).DataItem)
["FIELD1"]
I can then set the visible property for the button based on any field or combination of from the bound data, example:
DataRowView DRV = (DataRowView)((GridViewRow)((Control)sender).Parent.Parent).DataItem;
if (DRV["FIELD1"].ToString().Trim() == "1234567")
((Button)sender).Visible = false;
else ((Button)sender).Visible = true;
sure there is a more efficient way but it works

JustLearning
- 3,164
- 3
- 35
- 52

Stephen Symonds
- 31
- 3