set value to radgrid from radwindow

2 posts, 0 answers
  1. Fauzan
    Fauzan avatar
    3 posts
    Member since:
    May 2013

    Posted 23 May 2013 Link to this post

    hi, im newbie in telerik, i want to ask my problem

    i have a grid, textbox and button in parent form.
    the button in parent form will show the radwindow when we clicked it, and we can choose the griditem in that radwindow .
    when we closed it,  its automatically set field to textbox in parent form AND changed the grid in parent form too, depanding value in  radwindow argument.

    the parent form
    <telerik:RadScriptBlock runat="server" ID="rsb1">
            <script type="text/javascript">
                function OnClientClose(oWnd, args) {
                    var arg = args.get_argument();
                 if (arg) {
                    var tb = document.getElementById('<%=TextBox1.ClientID %>');
                                  tb.value = arg.NamaUser;                             
                 <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
            ReloadOnShow="true" runat="server" >
                <telerik:RadWindow ID="RadWindow1" runat="server" Width="650" Height="480" Behaviors="Close"  OnClientClose="OnClientClose" Modal="True" ReloadOnShow="True"
                <div style="background-color: #e6e6e6;">
                       Choose User <telerik:RadButton ID="btnlistuser" runat="server" onclick="openWin(); return false;"></telerik:RadButton>  
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    but when i refresh parent page with "getRadWindow().BrowserWindow.location.reload()"  after that radwindow close, the argument in radwindow can't be read to textbox

    in child menu
    <script type="text/javascript">
            function getRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            function closeWindow() {
            function RefreshParentPage() {
            function GetFirstDataItemKeyValues() {
                var grid = $find("<%=RadGrid1.ClientID %>");
                var masterTable = grid.get_masterTableView();
                var selectedRows = masterTable.get_selectedItems();
                for (var i = 0; i < selectedRows.length; i++) {
                    var row = selectedRows[i];
                    var cell = masterTable.getCellByColumnUniqueName(row, "USER_NAME");
                    var cell2 = masterTable.getCellByColumnUniqueName(row, "USER_ID");
                    var oArg = new Object();
                    oArg.myName = document.getElementById("myName").value;
                    oArg.Kode = cell2.innerHTML;
                    oArg.NamaUser = cell.innerHTML;
                    var currentWindow = getRadWindow();

    anybody can help me?
    thanks before
  2. Marin Bratanov
    Marin Bratanov avatar
    5459 posts

    Posted 27 May 2013 Link to this post

    Hi Fauzan,

    The call to window.location.reload() completely reloads the main form and thus all form values and custom JavaScript objects are lost. Since you already handle the data acquisition in the OnClientClose event of the RadWindow1 you simply need to remove the call to RefreshParentPage(); in GetFirstDataItemKeyValues() .

    If you need to reload some data in the main page you can use the OnClientClose handler to initiate the needed request with JavaScript. It can be an ajaxRequest() call from RadAjaxManager or you can store data in a hidden field and use a button and click() it or directly the __doPostBack() function MS AJAX has.

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top