Web Connection
Problem with wwWebMailLink
Gravatar is a globally recognized avatar based on your email address. Problem with wwWebMailLink
  Tore Bleken
  All
  Jul 2, 2015 @ 10:45am
I can't get this control to work, and I don't find any working sample to compare with. To test I created a very simple web form. Here's the important part of my wcsx:
<ww:wwWebMailLink ID="MailLink1" runat='server' EmailControlSource ="po.email" ControlSource ="po.username" />
<br />
<%= po.email%><br />
<%= po.username%>

And this is my code:

FUNCTION OnLoad()
public po
po = createobject('session')
po.addproperty('username','Some user')
po.addproperty('email','test@test.com')
this.databind()
ENDFUNC
* Onload

Please note that I updated the original message to not depend on external data. This code should work as is, as far as I have understood from the documentation.

Gravatar is a globally recognized avatar based on your email address. Re: Problem with wwWebMailLink
  Rick Strahl
  Tore Bleken
  Jul 3, 2015 @ 09:12am

Not sure.

This works fine for me:


  • Create a new page
  • Add a mail control
  • Add properties to the page to bind to

Then:


<label>Email Address:</label>
<ww:wwWebMailLink runat="server" ID="lnkEmail" ControlSource="this.Page.cName" EmailControlSource="this.Page.cEmail" />

and the code in the code behind:

*****************************************************************
DEFINE CLASS Default_Page as WWC_WEBPAGE OF WWC_WEBPAGE_FILE
*****************************************************************
*** Your Implementation Page Class - put your code here
*** This class acts as base class to the generated page below
*****************************************************************

#IF .F.
*** This line provides Intellisense: Ensure your path includes this page's location
LOCAL this as Default_Page_WCSX of default_page.prg
#ENDIF

cEmail = "rstrahl@west-wind.com"
cName = "Rick Strahl"

*****************************************************************
* OnLoad
****************************************

FUNCTION OnLoad()

this.lnkEmail.DataBind()

ENDFUNC
* Onload

...

ENDDEFINE

This works fine.

Note that you may have to explicitly bind the mail control instead of using DataBind() on the form because this control has to be always bound, not just on the first run through (if !IsPostBack).


+++ Rick ---



I can't get this control to work, and I don't find any working sample to compare with. To test I created a very simple web form. Here's the important part of my wcsx:
<ww:wwWebMailLink ID="MailLink1" runat='server' EmailControlSource ="po.email" ControlSource ="po.username" />
<br />
<%= po.email%><br />
<%= po.username%>

And this is my code:

FUNCTION OnLoad()
public po
po = createobject('session')
po.addproperty('username','Some user')
po.addproperty('email','test@test.com')
this.databind()
ENDFUNC
* Onload

Please note that I updated the original message to not depend on external data. This code should work as is, as far as I have understood from the documentation.



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: Problem with wwWebMailLink
  Tore Bleken
  Rick Strahl
  Jul 3, 2015 @ 10:43am
Thanks, got it to work. What got me confused, is that sometimes I must use this.oObject and sometimes this.page.oObject. Can you give me an easy to remember rule about when to use this.page and when to use "only" this?

Not sure.

This works fine for me:


  • Create a new page
  • Add a mail control
  • Add properties to the page to bind to

Then:


<label>Email Address:</label>
<ww:wwWebMailLink runat="server" ID="lnkEmail" ControlSource="this.Page.cName" EmailControlSource="this.Page.cEmail" />

and the code in the code behind:

*****************************************************************
DEFINE CLASS Default_Page as WWC_WEBPAGE OF WWC_WEBPAGE_FILE
*****************************************************************
*** Your Implementation Page Class - put your code here
*** This class acts as base class to the generated page below
*****************************************************************

#IF .F.
*** This line provides Intellisense: Ensure your path includes this page's location
LOCAL this as Default_Page_WCSX of default_page.prg
#ENDIF

cEmail = "rstrahl@west-wind.com"
cName = "Rick Strahl"

*****************************************************************
* OnLoad
****************************************

FUNCTION OnLoad()

this.lnkEmail.DataBind()

ENDFUNC
* Onload

...

ENDDEFINE

This works fine.

Note that you may have to explicitly bind the mail control instead of using DataBind() on the form because this control has to be always bound, not just on the first run through (if !IsPostBack).


+++ Rick ---



I can't get this control to work, and I don't find any working sample to compare with. To test I created a very simple web form. Here's the important part of my wcsx:
<ww:wwWebMailLink ID="MailLink1" runat='server' EmailControlSource ="po.email" ControlSource ="po.username" />
<br />
<%= po.email%><br />
<%= po.username%>

And this is my code:

FUNCTION OnLoad()
public po
po = createobject('session')
po.addproperty('username','Some user')
po.addproperty('email','test@test.com')
this.databind()
ENDFUNC
* Onload

Please note that I updated the original message to not depend on external data. This code should work as is, as far as I have understood from the documentation.



Gravatar is a globally recognized avatar based on your email address. Re: Problem with wwWebMailLink
  Rick Strahl
  Tore Bleken
  Jul 3, 2015 @ 11:51am

Inside of a control you have to use THIS.oPage because THIS is the control. On the Page you use this.cEmail.

You can also declare PRIVATE vars and reference those - that'll work as well.

FWIW... for the workshop in October we'll be focusing on scripts and templates rather than the Web control framework.

+++ Rick ---



Thanks, got it to work. What got me confused, is that sometimes I must use this.oObject and sometimes this.page.oObject. Can you give me an easy to remember rule about when to use this.page and when to use "only" this?

Not sure.

This works fine for me:


  • Create a new page
  • Add a mail control
  • Add properties to the page to bind to

Then:


<label>Email Address:</label>
<ww:wwWebMailLink runat="server" ID="lnkEmail" ControlSource="this.Page.cName" EmailControlSource="this.Page.cEmail" />

and the code in the code behind:

*****************************************************************
DEFINE CLASS Default_Page as WWC_WEBPAGE OF WWC_WEBPAGE_FILE
*****************************************************************
*** Your Implementation Page Class - put your code here
*** This class acts as base class to the generated page below
*****************************************************************

#IF .F.
*** This line provides Intellisense: Ensure your path includes this page's location
LOCAL this as Default_Page_WCSX of default_page.prg
#ENDIF

cEmail = "rstrahl@west-wind.com"
cName = "Rick Strahl"

*****************************************************************
* OnLoad
****************************************

FUNCTION OnLoad()

this.lnkEmail.DataBind()

ENDFUNC
* Onload

...

ENDDEFINE

This works fine.

Note that you may have to explicitly bind the mail control instead of using DataBind() on the form because this control has to be always bound, not just on the first run through (if !IsPostBack).


+++ Rick ---



I can't get this control to work, and I don't find any working sample to compare with. To test I created a very simple web form. Here's the important part of my wcsx:
<ww:wwWebMailLink ID="MailLink1" runat='server' EmailControlSource ="po.email" ControlSource ="po.username" />
<br />
<%= po.email%><br />
<%= po.username%>

And this is my code:

FUNCTION OnLoad()
public po
po = createobject('session')
po.addproperty('username','Some user')
po.addproperty('email','test@test.com')
this.databind()
ENDFUNC
* Onload

Please note that I updated the original message to not depend on external data. This code should work as is, as far as I have understood from the documentation.






Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

© 1996-2024