Visualizzazione dei risultati da 1 a 7 su 7

Discussione: ImageButton

  1. #1

    ImageButton

    ciao,
    come passo un parametro perso da db dentro ad un imagebutton?

    <asp:ImageButton id="ImageButton1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" OnClick='Vota(<%# DataBinder.Eval(Container.DataItem, "id") %>, 1)'></asp:ImageButton>

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30201: Expression expected.

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482
    Ma i dati sono salvati in un dataset?, e l'imagebutton si trova dentro ad un controllo tipo repeater o datalist o datagrid?

    Hey hey, my my Rock and roll can never die!

  3. #3

  4. #4
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482

    Re: ImageButton

    Ma la routine Vota come è fatta?

    Hey hey, my my Rock and roll can never die!

  5. #5
    sub Vota(ByVal id as Integer, ByVal voto as Integer)
    ...
    end sub

  6. #6
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482
    Guarda l'altro thread.

    PS

    Ti consiglio di fare il debug delle pagine, così vedi dove sta l'errore

    Hey hey, my my Rock and roll can never die!

  7. #7
    <ASP:ImageButton ID="Img1"
    CommandName="1"
    CommandArgument="<%# Container.DataItem("id") %>"
    OnCommand="Vota"
    Runat="Server"/>

    E nella Routine per ricavare il voto:

    Sub Vota(Obj as Object, E as CommandEventArgs)
    Dim Voto, ID
    Voto=E.CommandName
    ID=E.CommandArgument
    End Sub

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.