c# - Mail merge Data populate on radRichtextBox -


i need quick support populate mail merge data on radrichtextbox. in first step, populate list of data in mail merge "firstname", "lastname", want data associated these tags e.g firstname=peter ....please take of below lines of code. question how can load firstname, lastname data on document when press preview results.

on load

this.radrichtextbox.document.mailmergedatasource.itemssource = new list<employee>()             {                 new employee()                 {                     firstname = "guest1",                     lastname = "guest2",                   },                 new employee()                 {                     firstname = "ali",                     lastname = "doc",                  }             };  private void btnprint_click(object sender, routedeventargs e)        {            //this.radrichtextbox.insertfield(new mergefield() { propertypath = "firstname" });            mergefield field = new mergefield() { propertypath = "firstname" };            field.displaymode = fielddisplaymode.result;            this.radrichtextbox.document.changefielddisplaymode(field.fieldstart, fielddisplaymode.result);     } 

you can insert merge field in radrichtextbox's raddocument using insertfield method of radrichtextbox:

this.radrichtextbox.insertfield(new mergefield() { propertypath = "firstname" }, fielddisplaymode.result); 

note display mode set fielddisplaymode.result during insertion, ensure field evaluated using data source.

the fields in radrichtextbox have 3 display modes: code, displayname , result. if have inserted fields in code or displayname modes, can change mode of fields in document @ later time (after insert) using following:

this.radrichtextbox.changeallfieldsdisplaymode(fielddisplaymode.result); 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -