Hi Dmitry,
If you're wondering how to pass the TextBox's clientID into the
ImageButton's client-side script, how abou the following approach:
You can add "PreRender" event handler for the ImageButton control, in that
event, you can get the ClientID from the certain Textbox and then
programmatically set imagebutton's "OnClientclick" property?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Dmitry Duginov" <dima@nospam.nospam>
>References: <eXR6KhFPIHA.4912@TK2MSFTNGP06.phx.gbl>
<2E65CBBD-D1EE-4CA5-B6D2-FDB046E908F3@microsoft.com>
>Subject: Re: running javascript when textbox value has changed
>Date: Wed, 12 Dec 2007 09:18:51 -0500
[quoted text clipped - 94 lines]
>>>
>>> D.
Dmitry Duginov - 13 Dec 2007 03:28 GMT
> Hi Dmitry,
>
[quoted text clipped - 4 lines]
> event, you can get the ClientID from the certain Textbox and then
> programmatically set imagebutton's "OnClientclick" property?
Great, thanks. I've placed it together with two other calls for this script.
Works fine.
protected void FormView1_DataBound(object sender, EventArgs e)
{
if (FormView1.CurrentMode == FormViewMode.Edit)
{
TextBox pickuptextbox =
(TextBox)FormView1.FindControl("dataPickUpDate");
TextBox ETAtextbox = (TextBox)FormView1.FindControl("dataEta");
ImageButton pickupCalendarButton =
(ImageButton)FormView1.FindControl("cal_dataPickUpDate");
pickuptextbox.Attributes.Add("onchange",
String.Format("clearETA('{0}');", ETAtextbox.ClientID));
pickuptextbox.Attributes.Add("onkeypress",
String.Format("clearETA('{0}');", ETAtextbox.ClientID));
pickupCalendarButton.OnClientClick =
String.Format("javascript:showCalendarControl(this.previousSibling);clearETA('{0}');return
false;", ETAtextbox.ClientID);
}
}
Regards,
D.
> Sincerely,
>
[quoted text clipped - 113 lines]
>>>>
>>>> D.