I have a question regarding the OnItemDataBound event and I'm hoping someone can help me out.
Right now I have
and the function definition is:
protected void FillRepeater(object sender, RepeaterItemEventArgs e)
What I'd like to do is pass a parameter to the function like this:
But I'm not sure this is possible? I've edited my function definition to
protected void FillRepeater(object sender, RepeaterItemEventArgs e, int num)
but I'm not sure how to edit the markup to pass the first 2 expected parameters?
You can't modify the signature of ASP.NET server control event handlers, but I suspect that you're trying to either pass the index of the current item or grab a property off of the current item. Here's a few lines that might help you out if that's your aim:
protected void FillRepeater(object sender, RepeaterItemEventArgs e)
{
// this will get the object that the current repeater item is bound to
YourItemType item = e.Item.DataItem as YourItemType;
// this will get the index of the current repeater item
var collection = repeater.DataSource as List<YourItemType>;
int itemIndex = collection.IndexOf(e.Item.DataItem as YourItemType);
}