.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Programmaticaly edit a hyperlink field

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :SharePoint

I have a list with a hyperlink field, and an event reciever which changes this field when a new item is added to the list. Here is the code:

public override void ItemAdded(SPItemEventProperties properties)

      using (SPSite site = new SPSite("http://dev_seventeen:999"))
        using (SPWeb web = site.OpenWeb())
          SPList lista = web.Lists["Projects"];

          foreach (SPListItem project in lista.Items)
            project["Link to Project Details"] = "http://dev_seventeen:999/SitePages/Project%20Details.aspx?pid=" + project["ID"].ToString();
The problem is that this code chages both the "Web address" and the "description"

View Complete Post

More Related Resource Links

Gridview hyperlink field

Hi I have a gridview that has two fields. Both fields are databound...but the one field is a hyperlink field which works fine...but I would like to add a Request.QueryString value to the the value retrieved from the database when setting the navigateurl property. Help would be much appreciated

HyperLink Field Value: RowCommand

Hello. I am accessing the ID field in my GridView RowCommand event (this works fine)... Dim f_iIndex As Integer = Convert.ToInt32(e.CommandArgument)Dim f_oSelectedRow As GridViewRow = grdImplementation.Rows(f_iIndex) Dim f_oAppIdCell As TableCell = f_oSelectedRow.Cells(0)Dim f_iAppId As Integer = CInt(f_oAppIdCell.Text.Trim)  However, when I try to access a HyperLink field the same way, I get nothing... <asp:HyperLinkField HeaderText="Name" DataTextField="Name"  DataNavigateUrlFields="AppId" DataNavigateUrlFormatString="View.aspx?AID={0}"  />  Dim f_oMerchCell As TableCell = f_oSelectedRow.Cells(2)Dim f_sMerch As String = f_oMerchCell.Text.Trim  Thanks in advance!

using a database field as a hyperlink query?

I have three tables in my sql database contactssurvey answersrespondent_initialContacts holds all customer data with custid. survey answers has assigned everyone how took the survey a number in a field called respondent_no.respondent_initial holds input from a webform where I populated it with the custid from contacts and respondent_no from survey answers before the webform input is inserted. I want to send an email to them that had there respondent_no in a hyperlink to the webform so that when they entered their data into the webform it would use the repondent_no to determine where to insert the form data.Example joe clicks http://www.myplace.com/order.aspx?23             Mike clicks http://www.myplace.com/order.aspx?125it would look up respondent_no (23) from the respondent_initial table and insert the data in that row in the database for joe's webform entry and it would look up respondent_no (125) from the respondent_initial table and insert the data in that row in the database for mike's webform entry.my code behind looks like this// Create command                comm = new SqlCommand("INSERT INTO respondent_inital (Practice_Name, Address1, Address2, City, State, Zipcode, Phone, Email, Contact, Dealer, item_9223, item_9129, item

Calculated column and hyperlink field type

Hi I have customer who is asking me if this is possible to provide filter based on the HyperLink field, where he could easly limit results to only those items where link field is filled. As filtering on hyperlink column type is not supported I was thinking to buld some calculated field based on it to return YES (if link is provided) or NO (if link is not provided). The problem is that hyperlink field type is not avialiable on the list of field to be used on calculated field. is there some workaround for that ? thanks for help   Mariusz Gorzoch Blog : http://mariusz.gorzoch.pl Twitter : http://twitter.com/MariuszGorzoch Facebook: http://www.facebook.com/mariusz.gorzoch

Set value of field in NewItem form through hyperlink

Here is my scenario. We're using SharePoint for project management, so I have a List of tasks that needs to be performed and another list containing elements for when people have worked on the tasks. That is, whenever a person has spent some hours on a task he must add an element to the second list specifying when he did the work, who did the work, how long he worked on it and which task he worked on. In a scenario where there are alot of tasks on the Tasklist it becomes very tedious to find the task in a dropdown menu on the NewItem form of the second list. Therefore I would like to add a column to the TaskList containing a link for each task so that when you click Task1's link you will be directed to the NewItem form of the second list with the Task field in the NewItem form set to Task1. My original idea was to use the url of the NewItem form to specify the value of one of it's fields such as: http://server/sites/site/list/NewItem.aspx?TaskField=Task1 If that makes any sense. But I haven't been able to find any way to do this. Does anyone have any idea of how I can make a link in the TaskList to redirect me to the NewItem form of the second list with a field value set based upon which link is clicked? /Michael

OOTB Approval Workflow SharePoint 2010 - Blank "Requested By" field appears in Task Item edit/view f



I am having a simple OOTB  approval worflow associated to the simple document library. Task is created when an document is uploaded to the library.  When I click the task item in task list, I see a blank field "Requested By"  right below the "Status" column and I am unable to understand from where this field is coming and how to populate this field. Any help would be great...

Content Query Webpart to show edit item link field in SPS2010


I have a Content Query Webpart in SharePoint 2010 that I would like to surface Documents grouped by content type. I wish to show the edit form or view Properties link as part of the fields shown in the results. When the User clicks on this link, it should take him to the edit form or view Properties page for the document.

Any ideas?

SharePoint field type "hyperlink or picture"



I am making a workflow which creates a task for a user.
When the task is created I want to insert an URL into a custom column in the task list of the field type "hyperlink or picture".
I have managed this through the following code in my createTask activity:

        private void CreateMyTask(object sender, EventArgs e)
              myTaskProperties.ExtendedProperties.Add("CustomLink", "http://mycustomsitelink.com/somelink");

The only problem is, I can't figure out how to set the display text for this link. It will show the entire link on the screen, and I would like it to show something like "My link" while clicking it would lead you to the URL.

using hyperlink as the field value item identifier in workflow

I am using Designer 2007 to create a workflow.  I am using the Set Field in Current Item action.  In the two columns that I'm trying to use as the identifier between the two lists, do they have to be the same column type?  For instance could one be a hypertext link and the other be a string?  And if they must be the same, say both are a hypertext link, does the URL have to be identical too, or just what becomes the link label?
There are no mistakes; every result tells you something of value about what your are trying to accomplish.

Field in edit form


Hi all,

 I have few fields in my edit form which only appear when the form is in edit mode. "Resolution Type" in service request form is one of them. I have another field that I want to behave the same way but I cant find a place that I can set this setting.

The settings I found only "optional", "hidden" and "required"

Any suggestions!

Filtering Foreign Key Field in Edit mode


 Hello there.

 I just wondered if it is possible to set up a filter on elements which populate the foreign key drop-down list in edit mode (so that not all elements from the column related by the foreign key are in the list, just the ones that comply with the filter)

 any suggestions?

SharePoint Edit Form Shows Field Tabs over Field Item - How Can I Hide These


I am working with a custom edit form in SharePoint designer and I notice that when the form is displayed it shows the form field title in the column on the left and also in a tab directly above each field in the column on the right.  My question is how do I remove those tabs? IOW I just want to show the form field title on the left and the form field on the right; I don't want those grey tabs above the form field.

Tom Molskow SharePoint Architect - If I solved the issue please propose my reply as the answer - Thanks!

Get lookup field text value, not a lookup's hyperlink

var myLookup = '<SharePointWebControls:LookupField FieldName="MyLookup" runat="server" ControlMode="Display"/>';

This code assigns to variable myLookup value '<a href="/mysite/Lists/dict/DispForm.aspx?ID=30&RootFolder=*">First</a>'. But i expect value 'First'.

How to avoid HTML code around the text value?

PS. Yes, i can remove any HTML from string programmatically, but if SP can simplify my life - why not use it?

Setting Task Field Values in Custom .aspx Edit Form and accessing through ExtendedProperties


Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:

// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
  // Create a hashtable that will be used to update the values of task fields
  Hashtable taskHash = new Hashtable();
  // For each field, create two values in the hashtable. If the field name 
  // matches a field in the Task content type, the field name will not be 
  // searchable as a key within the ExtendedProperties hashtable. So 
  // create a second field that is a duplicate of the first but having a 
  // name that doesn't exactly match an existing field in the Task 
  // content type. That way it will be a searchable ke

Newbie - from a workflow, can I send an email that lets the receiver edit a field from the email?


Hello - newbie here.

I have a workflow where it sends an email to someone with a link to the item. They then click the link to edit the item and save it. The change they make is settings a status field on the item in the list to A, B, or C

What i'd like to do is send an email where they can see the status choices for the item, then make the change directly in the email.

Is this possible without a massive amount of work? I'm not a developer - just trying to get something done.


Mandatory description field on a 'hyperlink or picture' column type on a list?


I've been given the task of making the 'description' field of a url column for a list on one of our sharepoint sites, mandatory.

The problem is that the field is already set as mandatory in the list template (deployed as a feature), although this only makes the web address / url portion of the 'new item' page a mandatory input. The box below this ('Type the description') remains a non mandatory field.

Is it possible to make this field mandatory as well? I would have to do this at a feature (schema.xml) level if so.


Business Data List web part, format field from database as hyperlink


I have a BDC with an entity that selects fields from a table. One of the fields is the full pathname to a file, or it could be a hyperlink.
When I display the entity in a Business Data List Web Part, all fields are displayed as text, without any formatting. I know the formatting can be modified using the XSL editor (under modify web part), I have found a sample with date-time format . Some basic formatting can also be done with de sharePoint designer, but nowhere have I found an example that allows me to format the column with the link as a clickable hyperlink.
My strong points are sql server and .net , but not XSL , can anyone give me an example of how th eformatting needs to be done in XSL?

tnx in advance

Jan D'Hondt - Database and .NET development
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend