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

problem with server side in user control

3 Answers 54 Views
Window
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Jul 2008, 03:12 AM
Hi all, 

I have an user control(UC) which have an input text and a button, when i pressed the button it opens a rad window that returns a value to the input control.

The problem is that all the code is in the client side but i need a property in the code behind of the UC that helps me get the value of the input text here is the code i have:

<script type="text/javascript">
    function openWin(url)
    {
        var oWnd = radopen(url, "RadWindow1");
        oWnd.setSize(500,500);
        oWnd.add_close(OnClientClose);
    }

    function OnClientClose(oWnd)
    {
        var returnValue = oWnd.argument.retValue;       
        var txt1 = document.getElementById("txt");
        txt1.value = returnValue;
    }
</script>

 <input id="txt" type="text" runat="server" />

here is working great, but the form that contains the UC need to get he value of the input text, so there i need a property that returns that value. if y add runat="server" to the input text it wont take the return value and doesnt rewrite anything over it.

How can i get this value in the server side? how can i create the property to obtain the value in the form that contains the control?.

Thanks  a lot .. it is really important for me to do that.

Pls help!!!

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 23 Jul 2008, 11:53 AM
Hi Daniel,

Sending arguments from the client to the server is out of the scope of the RadWindow control - this is a general ASP.NET task. You can find more information on how to call a server-side function via Javascript in various places in the Net (the asp.net forums are a good place to start). For example you can use __doPostBack() or RadAjax's ajaxRequest call to do this.



Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Daniel
Top achievements
Rank 1
answered on 24 Jul 2008, 01:49 PM
Tnaks Giorgy for the reply,

But if i set a return value of a rad window into an input text and i need to store that value in my database how can i do it???

There are difierent controls (some of them are asp.net controls like textbox with validators) and one of them is the input text.... I have a stored procedure that needs to be filled with the values of the controls. This event occurs when i clicked a asp:button in the code behind.

Pls help me with this it is really important i need to store that value in the db....

Thanks a lot
0
Georgi Tunev
Telerik team
answered on 28 Jul 2008, 01:11 PM
Hi Daniel,

As I said previously, the approach that you should choose depends entirely on you - __doPostback(), ajaxRequest, e.t.c. This task is not related to the RadWindow control and if your code is working as expected when using a standard browser's popup, it will work with RadWindow as well - the logic will be absolutely the same. Please check the links that I sent you and implement your logic for sending arguments on a standard HTML button click. Once ready, send me your implementation and I will rework it for you so it uses RadWindow instead of the popup.


All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Daniel
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or