Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
ModalPopupExtender e visualizzazione dettaglio repeater
venerdì 02 maggio 2008 - 20.33
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
volperubbia
Profilo
| Senior Member
375
messaggi | Data Invio:
ven 2 mag 2008 - 20:33
639_ProvaUpdatePanel.aspx.zip
Ciao a tutti,
sto aggiungendo un po' di funzionalità ajax alla mia applicazione asp.net (ho allegato un esempio).
Ho un repeater dove su ogni riga viene visualizzata una descrizione e una serie di image button. Cliccando su ciascuna (il command argument varia da imgbtn a imgbtn), si dovrebbe aprire il popup panel e fare qualcosa.
Basta mettere nell'ItemTemplate ..
<ItemTemplate>
<asp:ImageButton id="imgBtnReparto" runat="server" OnClick="imgBtnShowPopup_Click"></asp:ImageButton>
</ItemTemplate>
e nel codice vb
Private Sub rptData_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptData.ItemDataBound
Dim imgBtn As ImageButton = DirectCast(e.Item.FindControl("imgBtnReparto"), ImageButton)
If (Not imgBtn Is Nothing) Then
imgBtn.CommandArgument = "3|" & DataBinder.Eval(e.Item.DataItem, "Codice").ToString
End If
End Sub
Fin qui tutto ok.
Dal momento che le image button su ciascuna riga potrebbero essere N e questo lo so lato vb, vorrei fare una cosa del genere ...
Mettere nell'ItemTemplate solo ..
<ItemTemplate>
<%#Me.Links(CInt(DataBinder.Eval(Container.DataItem, "Codice")), Container)%>
</ItemTemplate>
e nel codice vb
Protected Function Links(ByVal Codice As String, ByVal Container As System.Web.UI.WebControls.RepeaterItem) As String
Dim strReturn As String = String.Empty
Dim strArgument As String = "1|" & Codice
strReturn &= "<input "
strReturn &= " type=" & Chr(34) & "image" & Chr(34)
strReturn &= " name=" & Chr(34) & (Container.ClientID & "_" & Me.imgBtnShowPopup.ID).Replace("_"c, "$"c) & Chr(34)
strReturn &= " id=" & Chr(34) & Container.ClientID & "_" & Me.imgBtnShowPopup.ID & Chr(34)
strReturn &= " OnClick=" & Chr(34) & "javascript:" & Page.ClientScript.GetPostBackEventReference(Me.imgBtnShowPopup, "3" & strArgument) & Chr(34)
strReturn &= " />"
strArgument = "2|" & Codice
strReturn &= "<input "
strReturn &= " type=" & Chr(34) & "image" & Chr(34)
strReturn &= " name=" & Chr(34) & (Container.ClientID & "_" & Me.imgBtnShowPopup.ID).Replace("_"c, "$"c) & Chr(34)
strReturn &= " id=" & Chr(34) & Container.ClientID & "_" & Me.imgBtnShowPopup.ID & Chr(34)
strReturn &= " OnClick=" & Chr(34) & "javascript:" & Page.ClientScript.GetPostBackEventReference(Me.imgBtnShowPopup, "3" & strArgument) & Chr(34)
strReturn &= " />"
Return strReturn
End Function
In pratica vorrei popolare da codice l'insieme delle N image button sulla riga, in modo da evitare di mettere le image button già nel codice aspx. Il codice funziona, il popup si apre. C'è solo un problema: non riesco ad impostargli il command argument, rimane sempre stringa vuota. Probabilmente uso GetPostBackEventReference in maniera errata ...
Qualche idea?
Davide
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !