Pregunta

I have dataGrid and LinkButton with javascript, how to get ID for MessageSend function?

<ItemTemplate>
<asp:ImageButton ID="MessageButton" runat="server" OnClientClick="javascript:void(MessageSend(SomeID))"  ImageUrl="Header.gif"/>
</ItemTemplate>

<asp:BoundColumn Visible="True" DataField="SomeID" ReadOnly="True" HeaderText="ID"></asp:BoundColumn>
¿Fue útil?

Solución

do this way

function MessageSend(sender) {
    // do whatever with the input
}

and in the OnClientClick use javascript:MessageSend(this);

The result is you get the sender element in your routine.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top