Javascript display property
Posted
by Nani
on Stack Overflow
See other posts from Stack Overflow
or by Nani
Published on 2010-04-28T14:41:52Z
Indexed on
2010/04/28
14:43 UTC
Read the original article
Hit count: 331
javascript-events
In my form I have a textbox and a calendr along with other controls
asp:TextBox ID="TextBox2" runat="server" onfocus="CalOpen()" asp:TextBox>
asp:Calendar ID="Calendar1" runat="server" style="display:none;" onselectionchanged="Calendar1_SelectionChanged">
script type="text/javascript">
function CalOpen()
{
var cal = document.getElementById('<%=Calendar1.ClientID%>');
cal.style.display='block';
}
/script>
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
TextBox2.Text = Calendar1.SelectedDate.ToLongDateString();
Calendar1.Visible = false;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Calendar1.Visible = true;
}
For the first time it worked fine, but, 2nd time when I click TextBox2, that is, after selecting date for the first time. Broeser is throwing error"object required"
I am unable to know where I went wrong.
Plz help me in making my code correct.
Thank You.
© Stack Overflow or respective owner