none
Remove Hyperlink column description in a sharepoint 2010 list

    Question

  • Hii,

    In SharePoint 2010 , when i add a column of Hyperlink , its automatically add description column also.But when we enter the values of respective fields its shows the description data in URL column.

    So, please give some suggestions how to remove this problem.

    Best Regards

    Mohit Sharma

    Tuesday, July 30, 2013 7:04 AM

Answers

  • Hello,

    This is design behavior and you can't change. Once you add hyperlink column you get address and description textboxs. Description text is use to hide the actual link and show some friendly name. For example:

    If you put http://www.msdn.com in address and put MSDN in description then in UI you will see MSDN.

    Since you have posted this question in development forum so i am assuming that you want to update this column via code. Here is sample code:

    // Create a link field value.
    SPFieldUrlValue msdnValue = new SPFieldUrlValue();
    msdnValue.Description = "SharePoint";
    msdnValue.Url = "http://msdn.microsoft.com/sharepoint";
                        
    // Create a new list item and set the URL field value.
    SPListItem msdnItem = list.Items.Add();
    msdnItem[SPBuiltInFieldId.URL] = msdnValue;
    msdnItem.Update();
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 8:29 AM
    Moderator
  • Hi,

    From my understanding, you may want to set an URL in URL column instead of description text.

    To achieve this, there are two solutions as follows:

    1. When adding a new item, leave the "Type the description" field empty, after saving you will see the URL appears in the URL column.

    2. Modify this list's "NewForm.aspx" in SharePoint Designer 2010, use jQuery code to hide the "Type the description" field, it will be invisible after that. The code is as follows:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
      var obj=$("input[title='Description']");
      obj.parents().find(".ms-formdescription:last").hide();
      obj.hide();
    });
    </script>
    

    Please inform me freely if you have any questions.

    Thanks

    Wednesday, July 31, 2013 11:25 AM
    Moderator

All replies

  • Hello,

    This is design behavior and you can't change. Once you add hyperlink column you get address and description textboxs. Description text is use to hide the actual link and show some friendly name. For example:

    If you put http://www.msdn.com in address and put MSDN in description then in UI you will see MSDN.

    Since you have posted this question in development forum so i am assuming that you want to update this column via code. Here is sample code:

    // Create a link field value.
    SPFieldUrlValue msdnValue = new SPFieldUrlValue();
    msdnValue.Description = "SharePoint";
    msdnValue.Url = "http://msdn.microsoft.com/sharepoint";
                        
    // Create a new list item and set the URL field value.
    SPListItem msdnItem = list.Items.Add();
    msdnItem[SPBuiltInFieldId.URL] = msdnValue;
    msdnItem.Update();
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 8:29 AM
    Moderator
  • Hi,

    From my understanding, you may want to set an URL in URL column instead of description text.

    To achieve this, there are two solutions as follows:

    1. When adding a new item, leave the "Type the description" field empty, after saving you will see the URL appears in the URL column.

    2. Modify this list's "NewForm.aspx" in SharePoint Designer 2010, use jQuery code to hide the "Type the description" field, it will be invisible after that. The code is as follows:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
      var obj=$("input[title='Description']");
      obj.parents().find(".ms-formdescription:last").hide();
      obj.hide();
    });
    </script>
    

    Please inform me freely if you have any questions.

    Thanks

    Wednesday, July 31, 2013 11:25 AM
    Moderator