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..
|