OnItemCommand in DataGrid

V

vijay

Hi all
I am using a datagrid in my aspx page. and i have some coulums which contains push buttons. i want to handle click events on these buttons. OnItemCommand is only working for link buttons. please help
regards
vijay.
 
T

Teemu Keiski

Hi,

can you clarify how does it work only for LinkButtons? Do you have normal
buttons with CommandName as well?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


vijay said:
Hi all,
I am using a datagrid in my aspx page. and i have some coulums which
contains push buttons. i want to handle click events on these buttons.
OnItemCommand is only working for link buttons. please help.
 
S

sayee vijay

Teemu Keiski,
<asp:Repeater id="Repeater1" OnItemCommand="CommandEvent"
runat="server"> <HeaderTemplate> <table> </HeaderTemplate>
<ItemTemplate>
<tr> <td>
<asp:Image Height=100 Width=100 ImageUrl='<%#
DataBinder.Eval(Container.DataItem,"vImagePath", "images{0}")%>'
Runat=server>
</asp:Image> </td>
<td>
<%#DataBinder.Eval(Container.DataItem,"vname")%>
</td>
<td>
<asp:Button Text='<%# DataBinder.Eval(Container.DataItem,"imovieid")%>'
CommandName="Add" Runat=server> </asp:Button> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>


In the above code i have place a button control [not a bound column],
and i have also implemented OnItemCommand event. When i press the button
"CommandEvent" [OnItemCommand event handler] function is not fired. But
when i replace the Button control to LinkButton "CommandEvent" function
is fired.

regards,
vijay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top