I want to call button click event of c# code in my javascript function without clicking on button
thanks in advance.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rahul SinghPosted Jan 5, 2015, 4:31 AM
I am considering even if you don't have a separate event handler you want to trigger ASP.NET button click without manually clicking the button through code.
Consider we have two buttons:-
And correspoing Button click handler for TestButton as:-
protected void TestButton_Click(object sender, EventArgs e)
{
Response.Write("Hello");
}
You can call this through JS function like this:-
function fnTest() {
var dontClickButton = document.getElementById("TestButton");
dontClickButton.click();
}
Sharad GuptaPosted Jan 6, 2015, 4:47 AM
your code is working perfectly now i am done with my problem.
Rahul SinghPosted Jan 5, 2015, 7:48 AM
Sharad GuptaPosted Jan 5, 2015, 6:36 AM
thanks for your code
can we allow that process on li click, do you have any idea about it.
Rahul SinghPosted Jan 5, 2015, 1:08 AM
Your question is not clear, I assume you want the server side button click event handler to be executed without clicking the button? But you need some event for that right? So my question is do you have any other event attached?
Abhishek KumarPosted Jan 2, 2015, 12:03 PM
Sharad GuptaPosted Jan 2, 2015, 5:51 AM
i use a html control and on click of that html control i want to process that functionality as i asked.
Thanks
Arjunan SelvamPosted Jan 2, 2015, 4:52 AM