Programmatically set url to hyperlink field? - InfoPath Dev
in

InfoPath Dev

Programmatically set url to hyperlink field?

Last post 12-24-2008 07:37 AM by jaiminsarda. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 12-23-2008 04:21 AM

    Programmatically set url to hyperlink field?

     Hi All,

    I have an hyperlink field in infopath 2007 form. 

    In my sharepoint document library, I have a template which should get open when user clicks that hyperlink (present in infopath form).

    So how can I programmatically set value(i.e. URL) to hyperlink field using c#??

     

     

    Thanks in advance

    Jaimin

    Filed under: ,
  • 12-23-2008 04:55 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Programmatically set url to hyperlink field?

    Hello,

    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.

  • 12-24-2008 12:55 AM In reply to

    Re: Programmatically set url to hyperlink field?

    Hi Shiva,

    thanks for the reply.

    i have created a textbox where on page load i am passing some url. i have bind this textbox with hyperlink control.

    when i pass the url: "http://www.google.com", it opens google in a new window. WORKS FINE..

    But when i pass the url like: "http://server:port//MyDocLib/TestDocument.doc", a new window opens with "Page Cannot be Found" error.

    Can you tell how can I open a document by clicking hyperlink??

     

    Thanks,

    Jaimin

  • 12-24-2008 01:46 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Programmatically set url to hyperlink field?

    Hello,

    Can you check once you're given URL is opened from Internet Explorer or not?

    Document should open using this URL: http://server:port//MyDocLib/TestDocument.doc

  • 12-24-2008 04:57 AM In reply to

    Re: Programmatically set url to hyperlink field?

     I checked in IE, but no luck.

    thereafter, i created an excel template used it as a content type. i entered the data into that file and saved it into the same document library. Name of this file is "Test1.xlsx".

    Now when i gave this url: "http://server:port/MyDocLib/Test1.xlsx"  in my code, it opened successfully!!! i don't understand y??

    Do u know the reason?

    One more question, through my code(C#) how can i open the template(i.e. content type)  ?? How can I get the Url of this content type?

     

    Thanks,

    Jaimin

     

     

  • 12-24-2008 07:05 AM In reply to

    Re: Programmatically set url to hyperlink field?

    Hi,

    Try the below URL in IE.

    http://server:port/MyDocLib/TestDocument.doc

    I just deleted the slash(/)  after server:port

    Swathip
    www.ggktech.com
  • 12-24-2008 07:18 AM In reply to

    Re: Programmatically set url to hyperlink field?

    jaiminsarda:

    Now when i gave this url: "http://server:port/MyDocLib/Test1.xlsx"  in my code, it opened successfully!!! i don't understand y??

    There is no reason a url would ever have two slashes between server:port and the next part of the address.  It seems that that's the reason it wasn't working before.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-24-2008 07:37 AM In reply to

    Re: Programmatically set url to hyperlink field?

     thankyou all... its working now.

     

     

    jaimin

Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.