This is a migrated thread and some comments may be shown as answers.

Changing data in itemdatabound callbacks?

3 Answers 361 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
William Finnegan
Top achievements
Rank 1
William Finnegan asked on 12 Dec 2006, 09:53 PM

Hi there,
i have a textbox in the groupHeaderSection1 called ResourceDivision. I am trying to test out the callbacks on the sections to see how to manipulate the data in the textbox.

The datafield property of the textbox is set up to pull text from the datasource, and it is displaying the text from the datarecord properly.

However..
1) I'd expect ResourceDivision.text content to be the dynamic content from the data record when stopping at breakpoints in the debugger in all callbacks. At least in one of the callbacks listed below? It isnt: it is showing the default text that's defined in the property panel for the textbox.
Looks like the data actually only gets bound to the textboxes AFTER the callbacks are triggered? Help?

2) I'd expected to be able to modify the data in the textbox through the callbacks, but since it seems to the actual binding is happening AFTER the callbacks it is actually overwritten with the actual datarecord's content.



private
void groupHeaderSection1_ItemDataBinding(object sender, EventArgs e)

{

this.ResourceDivision.Text += "-1";

//this is nor reflected anywhere?

}

private void groupHeaderSection1_ItemDataBound(object sender, EventArgs e)

{

this.ResourceDivision.Text += "-2";

//this is nor reflected anywhere?
}

private void detail_ItemDataBinding(object sender, EventArgs e)

{

this.ResourceDivision.Text += "-3";

//this is nor reflected anywhere?
}

private void detail_ItemDataBound(object sender, EventArgs e)

{

this.ResourceDivision.Text += "-4";

//this is nor reflected anywhere?
}

Thanks,
Eric

3 Answers, 1 is accepted

Sort by
0
William Finnegan
Top achievements
Rank 1
answered on 12 Dec 2006, 10:09 PM
OK,
I was talking nonsense. The API is just slightly different than I anticipated:
You can bind per section or per data element (i.e. textbox).
so if you specify the ItemDataBound callback per textbox you can modify
 the text pulled from the datasource to anything there.

All good!
eric

private void txtManufacturer_ItemDataBound(object sender, EventArgs e)

{

Telerik.Reporting.TextBox tb = (Telerik.Reporting.TextBox)sender;

tb.Text += "-1";

}

0
William Finnegan
Top achievements
Rank 1
answered on 13 Dec 2006, 02:04 PM
On a related note, how to I modify the visibility of a textbox on the itembound callback of another textbox? I need to turn off a another textbox when there isnt any data for the textbox i have the callback on...

I noticed in the itembound you are passed a reference to the textbox itself through the 'Object sender' parameter. But how can you maipulate other textboxes in that callback? (Just accessing it by the Id specified in the design view doesnt work which is understood as there can be multiple instances of the textbox: one for each record.)

Also: page numbering? I dont see where I can specify those?

Thanks!
0
Rossen Hristov
Telerik team
answered on 14 Dec 2006, 02:00 PM
Hi William,

In this first CTP version of telerik Reporting events are only added to demonstrate that there will be such. This is by no means their final and working version. We are currently working on the events mechanism and it will surely evolve with the next pre-beta versions.

Thank you for your suggestions, this was some very helpful insight and we will definitely have it in mind while developing our reporting tool.
 

Best wishes,
Rossen
the telerik team
Tags
General Discussions
Asked by
William Finnegan
Top achievements
Rank 1
Answers by
William Finnegan
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or