SharePoint - How to set the Display Text for hyperlink control in infopath programatically?

Asked By Muthu Kumar on 06-Jul-12 04:20 AM
Hi All,

I need the code to set the display text for hyperlink field in infopath programatically. I have able to set the URL for the hyperlink field using xpathnavigator.setvalue(http://www.google.com). But, i need the code to display the text like 'Google' for the hyperlink control and when clicking the 'Google' link it will navigate to the URL 'http://www.google.com/' using programatically?... Any Ideas?...

Thanks & Regards,
Muthukumar.G
Somesh Yadav replied to Muthu Kumar on 06-Jul-12 05:08 AM

Programmatically set url to hyperlink field in InfoPath

We do not access the Hyperlink in code. If you want to set that hyperlink value in code then in design mode you to follow these steps,
  1. Right click on Hyperlink to get Edit Hyperlink window
  2. Select ‘Data source' option in ‘Link to'.
  3. Click on icon to select which field data you want to bind it.
  4. Click on OK button.
    In your code you have to set step3 field data as what link you want to show in hyperlink.