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

Pass a value to radwindow

7 Answers 558 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 23 May 2013, 03:34 PM
So been looking at telerik sites to but each time the page comes up as missing for passing values thru query string to radwindow.
What I need to do is this, I need to pass a value into my radwindow to fill out a checkbox list with items that are checked per what region they pick on the radgrid.  So if they pick on a region and it has stations the radwindow will open with those stations already picked in the checkboxlist.   How can I do this. 


<telerik:RadGrid ID="myRadGrid" runat="server" Width="40%" Skin="Web20" CssClass="dvGridWrapper">
           <MasterTableView AutoGenerateColumns="false" Font-Size="10" DataKeyNames="intRegionID" CommandItemDisplay="Top">
               <HeaderStyle ForeColor="White" Font-Bold="true" HorizontalAlign="Center" />
               <ItemStyle HorizontalAlign="Center"/>
               <AlternatingItemStyle BackColor="#B0C4DE"  HorizontalAlign="Center" />
                   <Columns>
                       <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                       <telerik:GridTemplateColumn>
                           <ItemTemplate>
                               <asp:LinkButton ID="lnkAssign" runat="server" CommandArgument='<%# Bind("strRegionCode")%>' Text="Assign Teams" CommandName="Assign" OnClientClick='<%# String.Format("addAdminWin({0}, {1}); return false;", Eval("intRegionID"), 2)%>'></asp:LinkButton>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>



I am filling out hte Radwindow right now on page load but I need the items checked that actually need to be checked from the reagion that they pick.
Private Sub FIllCb()
      sql = "select t.intTeamID, t.strTeamCode + ' - ' + t.strTeamName + ' (' + r.strRegionCode + ')' from Team as t left outer join Region as r on t.intRegionID = r.intRegionID"
 
      buildDD(sql, cbTeams)
  End Sub

7 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 23 May 2013, 03:54 PM
So this is what i tried doing, I tried adding a hidden field and then checking chekcbox items based on when they click the link button on the radgrid via the commandname, but it does not work, now a a loss with this.  treid changing the link button text to see if passes thru and it does not.

Private Sub FillCbToRegion(ByVal region As Integer)
       sql = "select intTeamID from Team where intRegionId = " & region & " and bitActive = 1"
 
       myDataTable = New DataTable
       myDataTable = getData(sql)
 
       For Each row As DataRow In myDataTable.Rows
           For Each Item As ListItem In cbTeams.Items
               cbTeams.SelectedValue = row(0)
           Next
       Next
 
       lnkClearAll.Text = region
   End Sub


If (e.CommandName = "Assign") Then
           Dim Region As Integer = e.CommandArgument
           FillCbToRegion(Region)
       End If
0
Marin Bratanov
Telerik team
answered on 27 May 2013, 03:19 PM
Hello Kevin,

I advise that you examine the following demo that shows one way to pass querystring values to a RadWindow from a RadGrid: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window. It uses an <asp:QueryStringParameter> in the SqlDataSource in EditFormcs.aspx page. This is one way to get data from a querystring. The other is to use server code and access it through the Request.Querystring collection, so you can run your code in the content page. In both cases you must make sure that the URL is formed correctly. You can easily test it with window.open instead of window.radopen() because the browser offers an address bar where you can see the URL.

I am adding here a simple example that obtains the querystring values passed from the JavaScript function in the code-behind of the dialog page. You can use this logic to access these values. This example is based on the demo I linked above and uses the database from our demos. You can change the column names and use your own.

Regards,
Marin Bratanov
Telerik
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.
0
Brian
Top achievements
Rank 1
answered on 09 Jul 2014, 02:09 PM
Every example here is for passing data to a RadWindow using QueryString parameters. Is it possible at all to POST data to the URL set for the RadWindow. If data was post using a javascript ajax call, the URL link overrides even though the post happens via javascript. 

Is there a straight forward way to POST data into RadWindow where the URL is a different domain/URL than the parent page that loads it. Any help is appreciated. 
0
Marin Bratanov
Telerik team
answered on 10 Jul 2014, 08:30 AM

Hello Brian,

If you can POST data in the desired manner to a simple iframe with the page from the other domain, the same approach would work with RadWindow. Note that RadWindow sets the src of its iframe with JavaScript when you call its show() or setUrl() method.

I am not aware of ways to do that, though, as the JavaScript same-origin policy will not let JavaScript access that other page in the iframe in order to generate a new POST.

If you only need to create a POST request and put the result in a RadWindow - you can use its ContentTemplate and set the desired HTML there once you receive it, but the RadWindow itself does not offer such a facility to generate custom requests.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Shinu
Top achievements
Rank 2
answered on 10 Jul 2014, 09:58 AM
Hi Brian,

Please try the following options to pass a value from one page to another. These options are valid only if both sender and receiver page is on the same application.
  • Session
  • Cookies
  • Cache
  • Application Variables
  • Http Context

Thanks,
Shinu.

0
Brian
Top achievements
Rank 1
answered on 11 Jul 2014, 02:11 PM
Marin, thanks for your response. I guess my only option is to use RadWindows's ContentTemplate and set the desired HTML there once you receive it from ajax post call. Is there a way to access the contenttemplate and set the html via javascript code? 
0
Marin Bratanov
Telerik team
answered on 14 Jul 2014, 09:38 AM

Hello Brian,

You can use the set_contentElement(domElement) method listed in the control's Client-side API reference: http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Marin Bratanov
Telerik team
Brian
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or