Manipulating MergeField Codebehind

3 posts, 0 answers
  1. Raimund
    Raimund avatar
    10 posts
    Member since:
    Dec 2010

    Posted 20 Aug 2011 Link to this post

    Hello,

    does someone knows a way how to access and change a value of a MergeField in codebehind?
    I dont want to bind this Object to a datasource - the functionality should be like this
    mergeField["Name"] = "Raimund Rittnauer";

    To create new MergeFields and fill them with custom values.

    Maybe someone knows how I can use MergeFields in this way.

    Best regards,
    Raimund
  2. Alex
    Alex avatar
    13 posts
    Member since:
    Aug 2010

    Posted 22 Aug 2011 Link to this post

    Hi Raimund,

        Do you need to do this multiple times or just one time at startup ? If you just need to do it one time at the beginning I might be able to help you. 
        Basically what I do is create a list of Dictionary<string,string> in which and then using reflection create a type(the type has properties with the names of the keys in the dictionary) and then a list of objects of that type(one new instance of the type for each Dictionary) and then feed that list tot he ItemsSource.
     
    If this helps I can send you the code.

    Alex.
  3. DevCraft banner
  4. Boby
    Admin
    Boby avatar
    595 posts

    Posted 25 Aug 2011 Link to this post

    Hello Alex,
    Evaluatation of merge fields values is performed within the MailMerge method of RadDocument or RadRichTextBox, using the values from RadDocument.MailMergeDataSource.ItemsSorce; it cannot be done without setting the ItemsSource.

    Kind regards,
    Boby
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top