Link to home
Start Free TrialLog in
Avatar of tariqanis
tariqanis

asked on

Is there a way to perform Click even with code in ASP.net

Hi,

In Visual Basic I can perform the Click event with code using some thing like this:
Button1.PerformClick()
I tried doing the same in ASP.Net Code-behind page but found that it was not supported, does any one know of a way around this?

Thanks
Avatar of Tristan Shortland
Tristan Shortland
Flag of United Kingdom of Great Britain and Northern Ireland image

   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Write("Hello World!")
    End Sub
The key things here are the signature of the method and the handles clause.
If you're using visual studio 2005 you can just double click the button in design view and it will generate the click method for you...
Avatar of tariqanis
tariqanis

ASKER

Hi TShortland:,

I guess I didn't make myself clear. What I needed was this:
Click on button1 where is code to raise a click event for button2
In other words: instead of asking the user to click on button2 to perform a certain action, I use code to tell button2 to perform the required action.
Sorry if my question was not expressed clearly.

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Tristan Shortland
Tristan Shortland
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot