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

[Solved] Passing data from a Window to the View

2 Answers 111 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adam
Top achievements
Rank 1
Adam asked on 13 Dec 2010, 03:11 AM
Hello
I would like to know how to pass data back from a Window to the calling View.  For example:

1. I have a View which has a Button and a TextBox (lets call it TextBox1).
2. When the user clicks the Button a Window appears with a Texbox in it (lets call this textbox Textbox2).
3. The user enter some data into Textbox2 and closes the Window.
3. The text entered into Textbox2 (from the Window) should be passed back to TextBox1 in the parent View.

Can this be done?  I know that I can subscribe to the Close event which takes an argument 'e', but Im not sure how to use it to receive data from a window object. 

This type of functionality is useful in scenarios where a user may need to do a lookup for a related record which could be associated with a parent record (similair to a CRM type application).

Any help is appreciated.
Regards
Adam

2 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 13 Dec 2010, 02:07 PM
Hello Adam,

 Thank you for contacting us.

 In order to achieve your goal you need to do:
 1. Add a Html.BeginForm in the window.
 2. In your action method set incoming data in ViewDate["...."].
 3. Display your data.

 For your convenience I have attached a simple test project, which implements the suggested approach.

All the best,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Adam
Top achievements
Rank 1
answered on 13 Dec 2010, 02:40 PM
Hristo
This is exactly what I was looking for.  Thank you!
Tags
Window
Asked by
Adam
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Adam
Top achievements
Rank 1
Share this question
or