Hi
I read the post at http://www.telerik.com/help/reporting/understanding-events.html to know how to retrieve the value of the data from datasource before rendering all of the parts of the report
However, no matter what i tried to set the width of my TextBoxSeg ... the FIRST row data won't be reformatted correctly
Basically i want to display something similar to this XX-XX-XXXX-XXX-XXX . But i don't know EXACTLY how many characters for each segment. And that information only available when the data has been bounded to the textbox.
So I use the ItemDataBound event. Inside that event , I will find the length of the Data of the TextBox and set the width of the textBox corresponding to the Length.
Then i just need to move the Location of other segments correspondingly
That's the whole idea
I also attach the image of my report result to let you see the problem of rendering
this is the code
I read the post at http://www.telerik.com/help/reporting/understanding-events.html to know how to retrieve the value of the data from datasource before rendering all of the parts of the report
However, no matter what i tried to set the width of my TextBoxSeg ... the FIRST row data won't be reformatted correctly
Basically i want to display something similar to this XX-XX-XXXX-XXX-XXX . But i don't know EXACTLY how many characters for each segment. And that information only available when the data has been bounded to the textbox.
So I use the ItemDataBound event. Inside that event , I will find the length of the Data of the TextBox and set the width of the textBox corresponding to the Length.
Then i just need to move the Location of other segments correspondingly
That's the whole idea
I also attach the image of my report result to let you see the problem of rendering
this is the code
private Unit oneUnit = new Unit(100/8); private Unit originalTextSeg1Width; private Unit originalTextSeg2Width; private Unit originalTextSeg3Width; private Unit originalTextSeg4Width; private Unit originalTextSeg5Width; private Unit originalTextDash1X; private Unit originalTextDash2X; private Unit originalTextDash3X; private Unit originalTextDash4X; private Unit originalTextSeg2X; private Unit originalTextSeg3X; private Unit originalTextSeg4X; private Unit originalTextSeg5X; public GLIncomeStatementDT() { // // Required for telerik Reporting designer support // InitializeComponent(); //Original Width originalTextSeg1Width = textSeg1.Width; originalTextSeg2Width = textSeg2.Width; originalTextSeg3Width = textSeg3.Width; originalTextSeg4Width = textSeg4.Width; originalTextSeg5Width = textSeg5.Width; //Original X location originalTextDash1X = textDash1.Location.X; originalTextDash2X = textDash2.Location.X; originalTextDash3X = textDash3.Location.X; originalTextDash4X = textDash4.Location.X; originalTextSeg2X = textSeg2.Location.X; originalTextSeg3X = textSeg3.Location.X; originalTextSeg4X = textSeg4.Location.X; originalTextSeg5X = textSeg5.Location.X; // textSeg1.ItemDataBound += new EventHandler(textSeg1_ItemDataBound); textSeg2.ItemDataBound += new EventHandler(textSeg2_ItemDataBound); textSeg3.ItemDataBound += new EventHandler(textSeg3_ItemDataBound); textSeg4.ItemDataBound += new EventHandler(textSeg4_ItemDataBound); textSeg5.ItemDataBound += new EventHandler(textSeg5_ItemDataBound); this.DataSource = null; this.NeedDataSource += new EventHandler(FilteredReport_NeedDataSource); // // TODO: Add any constructor code after InitializeComponent call // } #region Setup Seg's Width dynamically void textSeg5_ItemDataBound(object sender, EventArgs e) { Telerik.Reporting.Processing.TextBox textSeg5Position = (Telerik.Reporting.Processing.TextBox)sender; textSeg5.Style.BackgroundColor = Color.Purple; textSeg5.Width = originalTextSeg5Width * (textSeg5Position.Text.Length); } void textSeg4_ItemDataBound(object sender, EventArgs e) { Telerik.Reporting.Processing.TextBox textSeg4Position = (Telerik.Reporting.Processing.TextBox)sender; textSeg4.Style.BackgroundColor = Color.Yellow; textSeg4.Width = originalTextSeg4Width * (textSeg4Position.Text.Length); textDash4.Location = new PointU() { X = originalTextDash4X + textSeg4.Width - oneUnit, Y = textDash4.Location.Y }; textSeg5.Location = new PointU() { X = originalTextSeg5X + textSeg4.Width - oneUnit, Y = textSeg5.Location.Y }; } void textSeg3_ItemDataBound(object sender, EventArgs e) { Telerik.Reporting.Processing.TextBox textSeg3Position = (Telerik.Reporting.Processing.TextBox)sender; textSeg3.Style.BackgroundColor = Color.Green; textSeg3.Width = originalTextSeg3Width * (textSeg3Position.Text.Length); textDash3.Location = new PointU() { X = originalTextDash3X + textSeg3.Width - oneUnit, Y = textDash3.Location.Y }; textSeg4.Location = new PointU() { X = originalTextSeg4X + textSeg3.Width - oneUnit, Y = textSeg4.Location.Y }; textDash4.Location = new PointU() { X = originalTextDash4X + textSeg3.Width - oneUnit, Y = textDash4.Location.Y }; textSeg5.Location = new PointU() { X = originalTextSeg5X + textSeg3.Width - oneUnit, Y = textSeg5.Location.Y }; } void textSeg2_ItemDataBound(object sender, EventArgs e) { Telerik.Reporting.Processing.TextBox textSeg2Position = (Telerik.Reporting.Processing.TextBox)sender; textSeg2.Style.BackgroundColor = Color.Blue; textSeg2.Width = originalTextSeg2Width * (textSeg2Position.Text.Length); textDash2.Location = new PointU() { X = originalTextDash2X + textSeg2.Width - oneUnit, Y = textDash2.Location.Y }; textSeg3.Location = new PointU() { X = originalTextSeg3X + textSeg2.Width - oneUnit, Y = textSeg3.Location.Y }; textDash3.Location = new PointU() { X = originalTextDash3X + textSeg2.Width - oneUnit, Y = textDash3.Location.Y }; textSeg4.Location = new PointU() { X = originalTextSeg4X + textSeg2.Width - oneUnit, Y = textSeg4.Location.Y }; textDash4.Location = new PointU() { X = originalTextDash4X + textSeg2.Width - oneUnit, Y = textDash4.Location.Y }; textSeg5.Location = new PointU() { X = originalTextSeg5X + textSeg2.Width - oneUnit, Y = textSeg5.Location.Y }; } void textSeg1_ItemDataBound(object sender, EventArgs e) { Telerik.Reporting.Processing.TextBox textSeg1Position = (Telerik.Reporting.Processing.TextBox)sender; textSeg1.Style.BackgroundColor = Color.Red; textSeg1.Width = originalTextSeg1Width * (textSeg1Position.Text.Length); textDash1.Location = new PointU() { X = originalTextDash1X + textSeg1.Width - oneUnit, Y = textDash1.Location.Y }; textSeg2.Location = new PointU() { X = originalTextSeg2X + textSeg1.Width - oneUnit, Y = textSeg2.Location.Y }; textDash2.Location = new PointU() { X = originalTextDash2X + textSeg1.Width - oneUnit, Y = textDash2.Location.Y }; textSeg3.Location = new PointU() { X = originalTextSeg3X + textSeg1.Width - oneUnit, Y = textSeg3.Location.Y }; textDash3.Location = new PointU() { X = originalTextDash3X + textSeg1.Width - oneUnit, Y = textDash3.Location.Y }; textSeg4.Location = new PointU() { X = originalTextSeg4X + textSeg1.Width - oneUnit, Y = textSeg4.Location.Y }; textDash4.Location = new PointU() { X = originalTextDash4X + textSeg1.Width - oneUnit, Y = textDash4.Location.Y }; textSeg5.Location = new PointU() { X = originalTextSeg5X + textSeg1.Width - oneUnit, Y = textSeg5.Location.Y }; }