Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the value of a textbox in the edititem part of a Gridview

Status
Not open for further replies.

monkeymagic2222

Technical User
May 13, 2002
78
0
0
GB
Hi,

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
 
But isn't the ClientID different depending on which row is being edited? i.e. GridView1_ctl03_txtEndDate for row 3
or GridView1_ctl04_txtEndDate for row 4.

Is there something like GridView1_SelectedRow_txtEndDate I can use?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top