Friday, July 12, 2013

Call buttonclick() function from javascript code

Lets say we have a textbox and a dropdown. Dropdown is loaded with employees.
and the requirement is to select the exact employee in dropdown based on the id entered in the textbox.

here is the design view of it.

and the design code.

if u look at the code. i have made a dummy button.i.e i have used it only for the  development wont be visible in the ui part. from the textbox on onkeydown() function i will be able to trigger the button_click of the dummy button.
so i will be able to perform those functions in the dummy buttons click event. have a look.

all validations and exceptions can be handled in the server side and it is handled too. have a look at the out put 

Still not feeling good? better download the source code here to have a better view of how it works.