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

how return value from radgrid in radwindow

3 Answers 272 Views
Window
This is a migrated thread and some comments may be shown as answers.
Luigi
Top achievements
Rank 1
Luigi asked on 12 Jan 2009, 10:21 PM
Hi all,
  i have a page base call a windows page like "details.aspx"
In this page datails i have a grid with more records, each record has one button for select row.

when i click on select button i want return a value of this record in the page base.

how i can make it ?

tnk's

L.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jan 2009, 06:38 AM
Hello Luigi,

One sugestion to achieve this is by setting the argument property of RadWindow in the Dialog page, and then read it in the OnClientClose event handler of Parent page. Access the cell value of row and set the value as the argument of radwindow. Then it is possible to get that value in parent page as shown in the following example.

Parent Page:

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
    <Windows> 
        <telerik:RadWindow runat="server" Behavior="Default" InitialBehavior="None"  
            Left="" NavigateUrl="Dialog.aspx" style="display:none;" Top=""  
            VisibleOnPageLoad="True" OnClientClose="OnClientClose"
        </telerik:RadWindow> 
    </Windows> 
</telerik:RadWindowManager> 

JavaScript:
<script type="text/javascript"
function OnClientClose(radWindow) 
    var oValue = radWindow.argument; 
    alert("Value from Dialog page  :"+ oValue); 
</script> 

Dialog Page:

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"   
            GridLines="None" AllowPaging="true" PageSize="5">  
<ClientSettings>  
<Selecting AllowRowSelect="true" />  
<ClientEvents OnRowSelected="OnRowSelected" />  
</ClientSettings>  
  
<MasterTableView autogeneratecolumns="False" datasourceid="SqlDataSource1" >  
<Columns>  
        <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName"   
            SortExpression="LastName" UniqueName="LastName">  
        </telerik:GridBoundColumn>  
        <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName"   
            SortExpression="FirstName" UniqueName="FirstName">  
        </telerik:GridBoundColumn>  
         . . . .  
</Columns>  
</MasterTableView>  
  
</telerik:RadGrid>  

JavaScript:
<script type="text/javascript"
function OnRowSelected(sender, eventArgs) 
    alert("Row: " + eventArgs.get_itemIndexHierarchical() + " selected."); 
    var oWindow = GetRadWindow(); 
    var oNewText = eventArgs.get_itemIndexHierarchical(); 
    alert ("Text to be returned to main page: " + oNewText); 
    oWindow.argument = oNewText; 
    oWindow.close();   
</script> 

Thanks,
Shinu.
0
Luigi
Top achievements
Rank 1
answered on 19 Jan 2009, 02:26 PM

tnk's for your reply, but for working you can insert:

Dialog Page:

 

function

 

GetRadWindow() {

 

 

var oWindow = null;

 

 

if (window.radWindow)

 

 

oWindow = window.radWindow;

 

 

else if (window.frameElement.radWindow)

 

 

oWindow = window.frameElement.radWindow;

 

 

return oWindow;

 

}

and modify this by return a value from radgrid

 

function

 

OnRowSelected(sender, eventArgs)

 

{

 

alert("Row: " + eventArgs.get_itemIndexHierarchical() + " selected.");

 

 

 

var oWindow = GetRadWindow();

 

 

var MasterTableView = eventArgs.get_tableView();

 

 

var cell = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "IDFIELD");

 

 

alert ("Text to be returned to main page: " + cell.innerHTML );

 

 

 

oWindow.argument = cell.innerHTML;

 

 

oWindow.close();

 

}

bye !

0
Luigi
Top achievements
Rank 1
answered on 16 Mar 2009, 03:40 PM
HI,
  i have another problem about this argument...

How can make a post page after i have received a value?

I want create a search about one list of employees
- I have one text field with a code of my employee, and one button for search.
- serach button show a windows popup for the list with a simple search
- when i found my employee, i chick on it's and your value code go in my "text field" on Parent page
- .... and now... ? how can make a post page for reload page and present all data about my employee

tnk's to all
Tags
Window
Asked by
Luigi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Luigi
Top achievements
Rank 1
Share this question
or