potresti postare il codice completo?

non ho ben capito quello che intendi...