Reputation: 107
I'm new to asp.net and I can't figure out why my onClick function isn't firing.
Here is my aspx code:
<asp:TextBox ID="TextBox1" runat="server" OnClick="TextBox1_OnClick"></asp:TextBox>
I then have a c# function that I need to run when the textbox is clicked:
protected void TextBox1_OnClick(object sender, EventArgs e)
{
//do stuff
}
Upvotes: 0
Views: 123
Reputation: 360
The event is not firing because there is no server side onClick event for textbox! Try to wire the event up on the client side!
Upvotes: 0
Reputation: 907
You should really consider using client side coding for this scenario. why do you have to go to the server to display a calender on click of a text box. All you have to do is write whatever is to be done in a javascript file and use it in client side. To do this, you can dothe following steps:
In your aspx page inside the <head></head>
tag include
<script type="text/javascript" language="javascript" src="YourJavaScriptFile.js"></script>
In your javascript file write a function to do whatever you want (display the calender).
I am not giving you the code as such because
Enjoy coding.
Upvotes: 2
Reputation: 1
I'd suggest to go for Ajaxtoolkit calendar control. Have a look at demo here
Upvotes: 0