Pass a value to radwindow

8 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 23 May 2013 Link to this post

    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

  2. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 23 May 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 27 May 2013 Link to this post

    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.
  5. Brian
    Brian avatar
    7 posts
    Member since:
    Jul 2014

    Posted 09 Jul 2014 in reply to Marin Bratanov Link to this post

    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. 
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 10 Jul 2014 Link to this post

    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.

     
  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jul 2014 in reply to Brian Link to this post

    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.

  8. Brian
    Brian avatar
    7 posts
    Member since:
    Jul 2014

    Posted 11 Jul 2014 Link to this post

    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? 
  9. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 14 Jul 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017