I have this code, which works:
But I dislike having to have two functions because I could net get it to pull the ID of the associated textbox. How would I replace the bolded area in the javascript function so I could successfully use just one opencalendar function and still pass the controlid back to populate the correct textbox?
Thanks,
wb
Code:
<script type="text/javascript">
function openCalendar() {
window.open('popup-calendar.aspx?ctlid=<%=[b]TextBox1.ClientID[/b] %>', 'Calendar', 'scrollbars=no,resizable=no,width=240,height=220');
return false;
}
function openCalendar2() {
window.open('popup-calendar.aspx?ctlid=<%=[b]TextBox2.ClientID[/b] %>', 'Calendar', 'scrollbars=no,resizable=no,width=240,height=220');
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
Start Date:<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="..." OnClientClick="javascript:return openCalendar();" />
<p></p>
End Date:<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="..." OnClientClick="javascript:return openCalendar2();" />
</form>
</body>
But I dislike having to have two functions because I could net get it to pull the ID of the associated textbox. How would I replace the bolded area in the javascript function so I could successfully use just one opencalendar function and still pass the controlid back to populate the correct textbox?
Thanks,
wb