Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Awesome Good Guys, :laugh:

I need your help. Please Help me. ;P

I encountered a very interesting problem regarding ENTER KEY STROKE on TEXTBOX data entry. Each time the after data entry and press ENTER KEY STROKE, it clear all the TEXTBOX data.

How do I ensure that when ENTER KEY is pressed by user it will not removed all the TEXTBOX Data.

These are the two events that the ENTER KEY STROKE seems to activate:

Protected Sub Page_Load(ByVal sender As Object,
                      ByVal e As System.EventArgs) Handles Me.Load
   'retrieve connection string from Web.config
    connstr = ConfigurationManager.ConnectionStrings("DataConnstr").ConnectionString

        If IsPostBack Then
            intPage = 1
            strCustID = Session("custid")
        End If
    End Sub

    Protected Sub BtnLoadGridView_Click(ByVal sender As Object, 
           ByVal e As System.EventArgs) Handles BtnLoadGridView.Click

        Dim intTotalPageCnt As Integer = 0
        GridView1.PageIndex = intPage - 1
        FLoadGridView()
        FCleartextBox()

        intTotalPageCnt = GridView1.PageCount
        Me.lblPage.Text = "Page : " & CType(intPage, String) & " of " & CType(intTotalPageCnt, String)

    End Sub





Thank you for your help.

Have a Good Day.
Cheers.
Lennie
Posted

Well, there's a method there called FCleartextBox, so I guess that's the issue. I am betting that you have autopostback turned on in the text box, so turn it off, or fix your code so that it doesn't clear the textbox if you don't want it to.
 
Share this answer
 
Comments
TeeLeong 2-Aug-10 19:29pm    
Reason for my vote of 5
Graus is awesome in sharing information to assist me.
TeeLeong 2-Aug-10 19:33pm    
Graus, is very generous in sharing information. He is awesome to be in the WONDERFUL FORUM. I am so glad to meet him here. Thank you very much. I have acquired new knowledge because of Graus generousity.
Hi Christian Graus :laugh: :laugh:

Yaaa...Hoooo..........Praise the Lord for your help and sharing your knowledge with me......Hallelujah ! :laugh:

I have tried out AUTOPOSTBACK and it works. My DataEntry WEBFRM1.aspx is now working very well.........You are awesome and generous in sharing information. I am so glad to meet you here at this WONDERFUL FORUM

Here are the sample amended coding:
<asp:textbox id=""txtCustAddr"" cssclass=""textbox"" width=""250px"" runat=""server"<br" mode="hold" xmlns:asp="#unknown" />                            EnableViewState="true" AutoPostBack="false"  >
  </asp:TextBox >






THANK YOU VERY MUCH AND MAY THE LORD BLESS YOU :laugh:


HAVE A GOOD DAY.
Cheers,
Lennie
 
Share this answer
 
v4
Comments
Yusuf 2-Aug-10 19:38pm    
Wow, we know you are excited, but people don't like bold fonts, it kind makes the post unpleasant (to put it mildly)
TeeLeong 2-Aug-10 19:45pm    
So sorry that the BOLD FONT has upset readers. My apology.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900