Tutorial :SPFieldUrl - doesn't always appear


Within my SharePoint list I use a field to hold a url and text, this is not a custom field, but its a standard SharePoint hyperlink field, SPFieldUrl type. When I set the SpFieldUrl Description and Url properties and save it to my list, on rare occations my data is never saved. How does this happen? Below is a sample of my code.

PopulateListItem(listItem,candidate);  listItem.Update();  SPFieldUrlValue newCandidateUrl = new SPFieldUrlValue();  newCandidateUrl.Description = listItem["Title"].ToString() +" ,"+listItem["FirstName"].ToString();  newCandidateUrl.Url = ConfigurationManager.AppSettings["EditUrl"]+"?id="+listItem.ID.ToString();  listItem["FormLink"] = newCandidateUrl;  listItem.Update();  


You may be getting an exception, for example if


is Null, Then


Will throw a nulll reference exception

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »