monkeymagic2222
Technical User
Hi,
First of all, apologies if this would be best suited to a Javascript forum.
I have some code that uses a pop up calendar to select a date. Once the date is selected it passes back to the specified text box on the form. This works fine on all my pages except when I use it in the editItem part of a Gridview. All I want to know is what I need to add to the following statement so I can get the value from the row I am currently editing, I know each row has it's own unique ID so the GridView1$txtStartDate will not work:
<asp:TextBox ID="txtStartDate" runat="server" Text='<%# Bind("start_date") %>'></asp:TextBox><a href="javascript:GetDate('Gridview1$txtStartDate')"><img alt="PopUp Calendar" src="SmallCalendar.gif" /></a>
If you need to see the GetDate function, it's:
<script type="text/javascript" language="Javascript">
function GetDate(CtrlName)
{
ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
}
function CheckWindow()
{
ChildWindow.close();
}
</script>
I've seen a lot of stuff about similar sorts of problems but they all seem a bit complex for what I'm trying to achieve.
Thanks
First of all, apologies if this would be best suited to a Javascript forum.
I have some code that uses a pop up calendar to select a date. Once the date is selected it passes back to the specified text box on the form. This works fine on all my pages except when I use it in the editItem part of a Gridview. All I want to know is what I need to add to the following statement so I can get the value from the row I am currently editing, I know each row has it's own unique ID so the GridView1$txtStartDate will not work:
<asp:TextBox ID="txtStartDate" runat="server" Text='<%# Bind("start_date") %>'></asp:TextBox><a href="javascript:GetDate('Gridview1$txtStartDate')"><img alt="PopUp Calendar" src="SmallCalendar.gif" /></a>
If you need to see the GetDate function, it's:
<script type="text/javascript" language="Javascript">
function GetDate(CtrlName)
{
ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
}
function CheckWindow()
{
ChildWindow.close();
}
</script>
I've seen a lot of stuff about similar sorts of problems but they all seem a bit complex for what I'm trying to achieve.
Thanks