How to retrive TextBox Value After User Edit In Preview Mode

Stimulsoft Reports.NET discussion
Post Reply
sphextor
Posts: 38
Joined: Tue Apr 01, 2008 1:42 am
Location: Thailand

How to retrive TextBox Value After User Edit In Preview Mode

Post by sphextor »

Please Help me

How to retrive TextBox Value After User Edit In Preview Mode

Thank you
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

How to retrive TextBox Value After User Edit In Preview Mode

Post 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.
sphextor
Posts: 38
Joined: Tue Apr 01, 2008 1:42 am
Location: Thailand

How to retrive TextBox Value After User Edit In Preview Mode

Post 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...
Pilgrim
Posts: 29
Joined: Fri Aug 03, 2007 7:57 am
Location: Cape Town

How to retrive TextBox Value After User Edit In Preview Mode

Post 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:
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to retrive TextBox Value After User Edit In Preview Mode

Post 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:

Code: Select all

SaveEditableFields(Stream stream)
Then all these values can be retrieved with the method:

Code: Select all

LoadEditableFields(Stream stream)
or
LoadEditableFields(string path)

Thank you.
Pilgrim
Posts: 29
Joined: Fri Aug 03, 2007 7:57 am
Location: Cape Town

How to retrive TextBox Value After User Edit In Preview Mode

Post 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:

Code: Select all

SaveEditableFields(Stream stream)
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!
Pilgrim
Posts: 29
Joined: Fri Aug 03, 2007 7:57 am
Location: Cape Town

How to retrive TextBox Value After User Edit In Preview Mode

Post 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)
Post Reply