L'Evento ItemCommand avviene quando un bottone del repeater viene premuto, e richiama gli elementi della classe RepeaterCommandEventArgs.codice:Sub MyRpt_ItemCommand(Sender As Object, e As RepeaterCommandEventArgs) If CType(MyRpt.Items.Item(e.Item.ItemIndex).FindControl("RDVoto"), RadioButtonList).SelectedIndex > -1 Then Response.Write(MyRpt.Items.Item(e.Item.ItemIndex).FindControl("RDVoto"), RadioButtonList).SelectedItem.Value) End If End Sub
"e.Item.ItemIndex" ti restituisce l'indice dell'itemtemplate in cui si trova il bottone premuto.
La funzione CType ("CType(expression, typename)") converte il valore "expression" nel tipo di controllo specificato in "typename".
OnItemCommand ovviamente rimanda all'evento di cui sopra...codice:<ASP:Repeater ID="MyRpt"...... OnItemCommand="MyRpt_ItemCommand"/>
Dato che devi gestire un evento del repeater e non del bottone, questa parte di codice quindi non serve più.codice:OnClick="Add_Voto"


Rispondi quotando