Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel
Postback of Textbox in Update Panel Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Go Back  Xtreme Visual Basic Talk > > > Postback of Textbox in Update Panel


Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2008, 11:43 AM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default Postback of Textbox in Update Panel


I have an input textfield within an Update Panel and a button outside the panel. I'd like to execute a button click when the user presses "Enter" in the textfield.

I know pressing enter will automatically cause a button click on a form, but it doesn't seem to work if the textfield is within the Update Panel.

I have then added a PostBackTrigger of the input TextBox along with the AsyncPostBackTrigger of the button for the Update Panel. But surprisingly, pressing "Enter" within the textfield causes a page-flicker and still doesn't execute the button click.

Any thoughts in getting the "Enter" key with the TextBox to cause a button click event?
Reply With Quote
  #2  
Old 01-04-2008, 12:28 AM
Desteny Desteny is offline
Centurion
 
Join Date: Nov 2003
Posts: 111
Default

in page_init try this...

if not autopostback then

call button_click

End if
Reply With Quote
  #3  
Old 01-04-2008, 05:58 PM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default

Hi Desteny,

Thanks for your help with this. But I'm a bit confused with your suggestion. Why would we not try to catch the textbox's autoPostBack on Page Init? Could you explain that logic a bit?

I've tried both, If Not AND If textbox.AutoPostBack Then....
Both times, nothing happens, I still get a page flicker but the function never gets executed.

Any other thoughts or suggestions?
Thanks.
Reply With Quote
  #4  
Old 01-05-2008, 10:02 AM
Desteny Desteny is offline
Centurion
 
Join Date: Nov 2003
Posts: 111
Default

Hmm, let me get this straight... You want a certain event to be fired when you hit enter?

take a look at this article, this should definitly solve your problem then:

http://harishmvp.blogspot.com/2006/0...lt-submit.html

Cheers
Reply With Quote
  #5  
Old 01-07-2008, 09:18 AM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default

Hi Desteny,

Thanks for your help with this. That article did help.

For all who have ran into the same issue I had, the fix that worked for me is by setting a "DefaultButton" on the form or panel associated with the text box.
For example....

Code:
<form id="form1" runat="server" defaultbutton="SendBtn">
   <div id="centerPanel">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div style="margin-top: 10px; margin-left: 40px;">
                     <asp:TextBox ID="InputMsgBox" runat="server" Width="424px" AutoCompleteType="Disabled"></asp:TextBox>
                     <asp:Button ID="SendBtn" runat="server" Text="Send" Width="56px" OnClick="SendBtn_Click" />
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="SendBtn" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
   </div>
</form>
Reply With Quote
  #6  
Old 01-09-2008, 07:17 AM
shaul_ahuvaPostback of Textbox in Update Panel shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

Glad to hear you got it resolved. However, if you are using IE this behavior is probably stemming from a known issue with IE and will happen in other situations as well.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
 
Postback of Textbox in Update Panel
Postback of Textbox in Update Panel
 
-->