c# - Make an asp:TextBox inside a Repeater fire the Repeater's ItemCommand when Enter pressed -
i've got repeater contains textboxes , linkbuttons. when click linkbutton, itemcommand event fires ok. wwhen press enter in of textboxes, form repeater inside submitted. ideally i'd want behaviour pressing enter in textbox performs same action clicking linkbutton - figure either have programmatically "click" linkbutton when enter pressed, or need way fire same itemcommand (with relevant command name/ argument) event linkbutton does
could give me clue how achieved? thanks
here possible approach. wrap textbox , linkbutton panel. panel provides option specify default button - button clicked when user hits enter in textbox inside panel.
<itemtemplate> <asp:panel id="panel1" runat="server" defaultbutton="linkbutton1"> <asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:linkbutton id="linkbutton1" runat="server" commandname="cmd" text="firecmd"/> </asp:panel> </itemtemplate> beware there might problem in ff linkbutton being default - here post describing both problem , solution. might outdated - post written in 2007, things might have changed since then.
Comments
Post a Comment