Updating hyperlink fields programmatically
Data in the Hyperlink Column can be populated / set in the following manners:
Item[“HyperLinkColumnName”] = “http://www.google.com, Google”;
Item.Update();
Don’t forget space after comma.
Or
SPFieldUrlValue MyURL = new SPFieldUrlValue();
MyURL.Description = “Google”;
MyURL.Url = http://www.google.com;
Item[“HyperLinkColumnName”] = MyURL;
Data from the Hyperlink Column can be get in the following manner:
SPFieldUrlValue MyURL = new SPFieldUrlValue(Item[“HyperLinkColumnName”].ToString());
string URLText = MyURL.Description;
string URL = MyURL.Url;
Comments
Post a Comment