473,378 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to activate button click event using enter button

1
hi,

I have designed a web part using VS 2003 (Web control library template). I need to publish that in share point. Its not like drag and drop the things from toolbar. Every thing I need to do in code behind side.

I have a button and text box

Button Id: btnSearch
TextBox id: txtSearch


Button performs search operation. I need to enter a text to be searched and when I click button means the button click event is activated. That is search function is activated and we can view the records in data grid.

What I need is that if I press the enter button inside the text box means the search function need to be done. In other words button click event should be fired and correspondingly data grid should be viewed.

I used key press event but it is not firing.
Here is my button search event…

protected void btnSearch_Click(object sender, System.EventArgs e)

{



SearchText = txtSearch.Text; //getting text to be searched from text box.

fillDataGrid(); //populating data grid..

}

Key press event…..

private void txtSearch_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)

{

if(e.KeyChar == (char) 13)

{

this.btnSearch_Click(sender, new EventArgs());

}

}

can any one say the solution...?

Thanks in advance..
May 11 '07 #1
0 2012

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Philip Townsend | last post by:
I have an aspx page that contains 2 user controls, each containing a seperate textbox and button. I would like to specify that one of the buttons recieve focus when the page loads. Also, I would...
5
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter...
6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
1
by: marcelo | last post by:
Hi I have the following scenario: one needs to confirm his password to authorize some operation. In the page, there's a brief of the operation, one asp:textbox and three asp:imagebutton...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
2
by: carmelo.orlando | last post by:
Hi to all, Im a new user of this group. I have a mdiParent form with a toolbar that contains some buttons. One of this button have to activate the function "click" of a button located into the mdi...
2
by: ari | last post by:
I have an MDI form with a listview and a toolbar. I have 2 instances of this form running at once - lets call them A and B. If I am in A, and I click on the listview control in B, then B's enter...
3
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username...
2
by: CGatto | last post by:
Hi, I have Windows Form with several User Controls embedded within. Only one user control is visible at any one time. The user moves through the various user controls by clicking Previous and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.