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

Passing parent control values to RadWindow from Grid Click

3 Answers 219 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 29 Jun 2009, 09:13 PM
I am currently launching a RadWindow from my grid when I click a row like so:
GRID:
<ClientSettings AllowDragToGroup="True" EnablePostBackOnRowClick="False"  
            EnableRowHoverStyle="True" ClientEvents-OnRowClick="RowClick"
            <ClientEvents OnRowClick="RowClick" /> 
        </ClientSettings> 

function RowClick(sender, eventArgs) { 
                    window.radopen("report_details.aspx?zipcode=" + eventArgs.getDataKeyValue("ZIPCode"), "UserListDialog"); 
                } 

But I also need to pass 3 other values from my page that are not part of the grid, two dates from RadDatePicker controls and a Numeric Textbox.  I tried to get them from the RadWindow page load like so:
Dim obj_startDate As RadDatePicker = Parent.FindControl("txt_start_date"
        Dim obj_endDate As RadDatePicker = Parent.FindControl("txt_end_date"
        Dim obj_Radius As RadNumericTextBox = Parent.FindControl("txt_Radius"
 
Dim startDate As Date = obj_startDate.SelectedDate 
        Dim endDate As Date = obj_endDate.SelectedDate 
        Dim Radius As Decimal = obj_Radius.Text 

But that doesn't work....  What am I missing here?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Jun 2009, 06:41 AM
Hi Shawn,

You can also pass the values of RadDatePicker and RadNumericTextBox as Url parameter when opening the window.

JavaScript:
 
function OnRowClick(sender, eventArgs)  
{  
     var RadDatePicker1 = $find('<%= RadDatePicker1.ClientID %>');   
     var date = RadDatePicker1.get_selectedDate();      
     var input = $find('<%= RadNumericTextBox1.ClientID %>');    
     var value = input.get_value();     
     var zipCode= eventArgs.get_gridDataItem().getDataKeyValue("zipcode");  
     var oWnd = radopen("report_details.aspx?zipCode=" + zipCode+"&date="+ date +"&value=" + value, "RadWindow1");  
     oWnd.Center();  

The parameters that you send can be read from the Request object in the Page_Load method of the RadWindow page.

C# code for report_details.aspx:
 
protected void Page_Load(object sender, EventArgs e)  
{  
    if (Request["zipCode"] != null && Request["date"] != null && Request["value"] != null)  
    {  
        Response.Write(Request["zipCode"]);  
        Response.Write(Request["date"]);  
        Response.Write(Request["value"]);  
    }  

Thanks,
Princy.
0
Peter Ivanov
Top achievements
Rank 2
answered on 28 Nov 2009, 06:28 AM
Hi,

I'm pretty new to web development and even more so to the .Net tools and controls. I'm currently working on a gridview with an edit button, this button has to open a radwindow and send 2 values to the window via a query string. How can I do this using VB.Net?

Thanks,

Peter.
0
Shinu
Top achievements
Rank 2
answered on 30 Nov 2009, 07:37 AM
Hi Peter,

Have you seen the online demo which shows how to use RadWindow for editing RadGrid records. You can pass the required values to the ShowEditForm function when adding the 'onclick' attribute to button from code. And then pass these values to the RadWindow as shown below when opening the window.

jscript:
 
function ShowEditForm(value1, ,value2 ,rowIndex) // First two parameters are passsed from code when adding the onclick attribute 
      var grid = $find("<%= RadGrid1.ClientID %>");                 
      var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); 
      grid.get_masterTableView().selectItem(rowControl, true); 
                         
      window.radopen("EditForm.aspx?FirstValue=" + value1+"&SecondValue="+value2, "UserListDialog"); 
 
      return false

-Shinu.
Tags
Window
Asked by
Shawn
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Peter Ivanov
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or