Обычно, когда у меня есть большой набор данных, который я перебираю для совпадений, я обнаруживаю, что использование словаря быстрее даже, чем операция. Find()
или перебор каждой строки.
Я бы попробовал что-то вроде
Dim dict As New Scripting.Dictionary
For filaIndiceFuente = 2 To filaFuenteUltima
dict.Add CStr(planillaFuente.Range("A" & filaIndiceFuente).Value), filaIndiceFuente '<- this will act as a pointer to the row where your match data is
Next filaIndiceFuente
For filaIndiceDestino = 2 To filaDestinoUltima
If dict.Exists(CStr(planillaDestino.Range("A" & filaIndiceDestino).Value)) Then
'CELLS GET TO THE OTHER FILE HERE
End If
Next filaIndiceDestino
Set dict = Nothing
.
Вы можете использовать: e.Item.DataItem
.
Пример: Событие Repeater.ItemDataBound
// This event is raised for the header, the footer, separators, and items.
void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
// Execute the following logic for Items and Alternating Items.
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
if (((Evaluation)e.Item.DataItem).Rating == "Good")
{
((Label)e.Item.FindControl("RatingLabel")).Text= "<b>***Good***</b>";
}
}
}
Данные, которые используются для текущего элемента, можно найти в EventArgs.
RepeaterItemEventArgs e
e.Item.DataItem
В зависимости от источника данных... Если ваш DataSource - DataTable, то ваш DataItem содержит DataRowView:
protected void rptMyReteater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Button b = e.Item.FindControl("myButton") as Button;
DataRowView drv = e.Item.DataItem as DataRowView;
b.CommandArgument = drv.Row["ID_COLUMN_NAME"].ToString();
}
}