postback when enter key?
am 15.07.2007 18:40:18 von jobs at webdos
asp.net 2.0.
I've got a web form when focused on a certain textboxes and i hit
enter, I want the page to postback to a particular event where I can
test textbox values.
I've tried a hidden default button with an event tied to it.. did not
work.
I've tried setting useSubmitBehavior on the button.
id="form1" runat="server">
asp:TextBox>
runat="server" Text="Button" />
Protected Sub Submit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Submit.Click
If TextBox_Search1.Text <> "" Then
TitleSearch()
End If
End Sub
I've tried settign autopostpack on the textboxes, but then it post
when any change is made to the textbox and I tab around.
Thanks for any help or information.
Re: postback when enter key?
am 15.07.2007 18:58:50 von mark
"jobs" wrote in message
news:1184517618.738994.323100@q75g2000hsh.googlegroups.com.. .
> I've tried a hidden default button with an event tied to it.. did not
> work.
That's right - when you set a webcontrol's Visible property to "false", it
doesn't even get rendered to the client...
> I've tried setting useSubmitBehavior on the button.
See above...
>
> runat="server" Text="Button" />
/>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Re: postback when enter key?
am 15.07.2007 22:13:47 von jobs at webdos
Thanks. makes sense. Any way to tie the enter key to any other
control. I have an asp.menu 2.0 in that form. It would be great if
ENTER defaulted as a click to one of the menu items. possible?
I'll need to research, but if you know off hand, possible to set a
menu item to visible = false in the codebehind?
Re: postback when enter key?
am 16.07.2007 08:37:33 von mark
"jobs" wrote in message
news:1184530427.248889.50440@g4g2000hsf.googlegroups.com...
> Thanks. makes sense. Any way to tie the enter key to any other
> control. I have an asp.menu 2.0 in that form. It would be great if
> ENTER defaulted as a click to one of the menu items. possible?
Not using the "wired-up" method, as that only supports buttons...
> I'll need to research, but if you know off hand, possible to set a
> menu item to visible = false in the codebehind?
MenuItems don't have a Visible property - however:
MyMenu.Items.Remove(MyMenu.FindItem("Customers"));
or
MyMenu.FindItem("Customers").ChildItems.Remove At(1);
--
Mark Rae
ASP.NET MVP
http://www.markrae.net