Page 1 of 1
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Tue Apr 01, 2008 1:43 am
by sphextor
Please Help me
How to retrive TextBox Value After User Edit In Preview Mode
Thank you
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Tue Apr 01, 2008 2:41 am
by Vital
You can use following code:
Code: Select all
StiText text = report.RenderedPages[0].GetComponents()["Text1"] as StiText;
string value = text.Text.Value;
Thank you.
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Tue Apr 01, 2008 3:42 am
by sphextor
Vital wrote:You can use following code:
Code: Select all
StiText text = report.RenderedPages[0].GetComponents()["Text1"] as StiText;
string value = text.Text.Value;
Thank you.
Great Thank...
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Mon May 12, 2008 2:44 am
by Pilgrim
Hi Vital.
This method works very well but I need something extra.
I need a way to get the original value of the StiText component using only the component returned by report.RenderedPages[0].GetComponents()["Text1"] as StiText;
Something along the lines of text.Text.OrinigalValue
The reason I need this is because my report consists of external subreports I have no way of knowing where that StiText came from, all I know is that it is editable.
I tried adding information to the StiText.Tag but the tag value is empty when I retrieve the StiText via the report.RenderedPages.
When I use report.GetComponents or report.CompiledReport.GetComponents the text.Tag contains a value.
Thank you :grinder:
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Mon May 12, 2008 4:19 am
by Edward
Unfortunately we do not have such a property in the StiText component, but you can save all editable values using the following method of the StiReport class:
Then all these values can be retrieved with the method:
Code: Select all
LoadEditableFields(Stream stream)
or
LoadEditableFields(string path)
Thank you.
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Mon May 12, 2008 5:12 am
by Pilgrim
Edward wrote:Unfortunately we do not have such a property in the StiText component, but you can save all editable values using the following method of the StiReport class:
Then all these values can be retrieved with the method:
Code: Select all
LoadEditableFields(Stream stream)
or
LoadEditableFields(string path)
Thank you.
Hi Edward.
I had a look at the SaveEditableFields method and it does not give me enough information.
They way I am using the editable field is it loads data from a data field. Then the user can edit it and save it again. What makes it difficult is that I cannot just go save the original dataset, I have to pass the new values on to the business object and it will go update whatever is needed to save the new data.
If I can have the original source of that text eg. {CUSTOMER.NAME} and I now have the new value "John" I can go save the customer name.
This is just a simple example of what I do.
The following works if it does not have any subreports:
Code: Select all
Dim oldText As StiText = TryCast(pReport.GetComponentByName(t.Name), StiText)
Dim originalText As String
If oldText Is Nothing Then
originalText = ""
Else
originalText = oldText.Text.Value.Trim
End If
where t is the editable text field I got from pReport.
RenderedPages(i).GetComponents
The problem is that once I have subreports i cannot use pReport.GetComponentByName(t.Name) any more. The text field does not come from this report and is not found.
I tried adding information into the Tag of the field but t.Tag.Value is always "" while oldText.Tag.Value contains the value I gave the field.
This is a very big problem for me at the moment and I will really appreciate it if you can do one of 2 things for me please:
1. Give me a way to access t.Text.OldValue (harder to do I realise but a lot better for my implementation)
2. Keep the value in t.Tag.Value when the report is rendered. (I hope this is easy)
Thanks!
How to retrive TextBox Value After User Edit In Preview Mode
Posted: Mon May 12, 2008 6:59 am
by Pilgrim
I found a way to get the Tag value:
Code: Select all
Dim e As New Events.StiValueEventArgs
t.InvokeGetTag(Me, e)
tagText = CStr(e.Value)