I'm trying to raise a button_click event in my code behind for a asp:Button, however it only seems to postback when I click it the SECOND time, rather than the first, am I missing something? Below is my code
<asp:Button AccessKey="Y" EnableViewState="true"
Height="25px" runat="server" ID="myButton"
Text="hello" OnClick="clickit" />
<asp:TextBox runat="server" AutoPostBack="true"
ID="sddf">
</asp:TextBox>
My code behind looks like this:
protected void clickit(Object sender, EventArgs e)
{
Unit myUnit = new Unit(50, UnitType.Pixel);
myButton.Height = myUnit;
}
Now techincally when I click the button it should post back and increase the height of the button to 50px from 25px, but I have to click it twice for it to do this? What am I doing wrong?