Thanks Jon.

Phil

Jon Finley wrote:

> Yes, very doable (several ways actually). Check out
> RegisterClientScriptBlock.
>
> It looks something like the following if done entirely in code behind.
> You can also do this via script in the HTML. This is from production
> code but I hacked out the irrelevant parts so forgive any errors.
>
> Jon Finley
>
> **************************
>
> In Page_Load
>             Dim scriptString As String
>             scriptString += "<script language=""JavaScript""> "
>
>             scriptString += "function CheckRequiredInfo() "
>             scriptString += "{ "
>             scriptString += "  var reqItems = ''; "
>             scriptString += "  if (document.Form1.txtHeading.value ==
> '') "
>             scriptString += "    reqItems = reqItems + 'Heading is
> required.\n'; "
>             scriptString += "  if (document.Form1.txtLinkLabel.value ==
> '') "
>             scriptString += "    reqItems = reqItems + 'Link Label is
> required.\n'; "
>             scriptString += "  if
> (document.Form1.txtPublicItemDescription.value == '') "
>             scriptString += "    reqItems = reqItems + 'Public
> Description is required.\n'; "
>             scriptString += "  if (document.Form1.txtEffectiveDate.value
> == '') "
>             scriptString += "    reqItems = reqItems + 'EffectiveDate is
> required.\n'; "
>             scriptString += "  if (document.Form1.txtSubmittedBy.value
> == '') "
>             scriptString += "    reqItems = reqItems + 'Submitted By is
> required.\n'; "
>             scriptString += "  if (reqItems == '') "
>             scriptString += "    return true; "
>             scriptString += "  else {"
>             scriptString += "    alert('The content has not been saved.
> The following errors were found: \n' + reqItems); "
>             scriptString += "    return false;} "
>             scriptString += "} "
>
>             scriptString += "</script>"
>
>             '-- Register script block on page
>             If (Not IsClientScriptBlockRegistered("clientScript")) Then
>                 RegisterClientScriptBlock("clientScript", scriptString)
>             End If
>
>             Me.btnSave.Attributes.Add("onClick", "if
> (CheckRequiredInfo()) return true; else return false;")
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 15, 2002 3:14 PM
> > To: dotnet
> > Subject: client side event handling for server side control
> >
> >
> > What I would like to do is when a user clicks on my
> > asp:imagebutton control, have client side code catch the
> > event (onmouseup, perhaps) and then have the logic of
> > that handler determine whether or not to call the server
> > side onclick event handler.
> >
> > Does anyone know how to do this?
> >
> > Thanks
> >
> > ---
> > You are currently subscribed to dotnet as:
> > [EMAIL PROTECTED] To unsubscribe send a blank email to
> > %%email.unsub%%
> >
> > ---------
> > Administrated by 15 Seconds : http://www.15Seconds.com
> > List Archives/Search : http://local.15Seconds.com/search
> > Subscription Information : http://www.15seconds.com/listserv.htm
> > Advertising Information: http://www.internet.com/mediakit/
> >
> >
> >
>
> ---
> You are currently subscribed to dotnet as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to %%email.unsub%%
>
> ---------
> Administrated by 15 Seconds : http://www.15Seconds.com
> List Archives/Search : http://local.15Seconds.com/search
> Subscription Information : http://www.15seconds.com/listserv.htm
> Advertising Information: http://www.internet.com/mediakit/


---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/


Reply via email to