none
compare before and after properties of multi line plain text column

    Question

  • PLEASE REPLY :I have a multiline textbox column( plain text) in my list. i want to write a code for that column in the edit form page such that update in that column are cancelled.

    I want to compare before and after update values of the multiline text box and i am stuck.

    I have this code for shrepoint 2007 can someone convert it for sharepoint 2010

    SPList list = web.Lists["Multi-line Text"];

    SPListItem item = list.Items[0];

    SPFieldMultiLineText mlt = item.Fields.GetField(FIELD_NAME) as SPFieldMultiLineText;

    string asText = mlt.GetFieldValueAsText(item[FIELD_NAME]);

    My list name is task and column name is description

    please suggest all the objects to declare and code to fetch before and after values of the multiline text box

    ThankYou


    sunny


    Friday, March 09, 2012 9:21 AM

Answers

  • hii all,

    i got the solution:

     

                    SPFieldMultiLineText mltPost = olstItem.Fields.GetField("Column_name ") asSPFieldMultiLineText;

                    string strPost = mltPost.GetFieldValueAsText(olstItem["Column_name"]);

                   

                    string strDescriptionAfterProp1 = properties.AfterProperties[properties.ListItem.Fields["Column_name"].InternalName].ToString();

                   


    sunny

    Monday, March 12, 2012 6:50 AM

All replies

  • The code is not going to be significantly different in SP 2010. Are you getting any issue when you execute the logic you have written for MOSS 2007?

    The code you have provided does not have any logic for comparing the old and new value of a field. Also will this code be part of event handler? or have you written a custom edit control for the item?


    Regards, Mahesh

    Friday, March 09, 2012 4:50 PM
  • hii all,

    i got the solution:

     

                    SPFieldMultiLineText mltPost = olstItem.Fields.GetField("Column_name ") asSPFieldMultiLineText;

                    string strPost = mltPost.GetFieldValueAsText(olstItem["Column_name"]);

                   

                    string strDescriptionAfterProp1 = properties.AfterProperties[properties.ListItem.Fields["Column_name"].InternalName].ToString();

                   


    sunny

    Monday, March 12, 2012 6:50 AM