SPListItem.Url is Invalid

Why SPListItem.Url would return this: /listname/2_.000 is beyond me. I hope there is a darn good reason for it SharePoint, I really do. Anyway, if you actually want to link to a list item rather than to an error page you can try something like this:

                            string url = lookupList.Items[id].Url;
                            linkUrl.Url = web.Url + “/” + url.Substring(0, id.ToString()) + “Dispform.aspx?ID=” + id.ToString();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s