open a aspx page at Radwindow and passing a value by querystring from a button click event

6 posts, 0 answers
  1. Debashis Pyne
    Debashis Pyne avatar
    66 posts
    Member since:
    Apr 2010

    Posted 09 Jul 2010 Link to this post

    Hi,
    I would like to open a aspx page at Radwindow and passing a value by querystring from a button click event.
    Without querystring , I was successful , but stuck-up at passing the value.

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
     <script type="text/javascript">
        function ShowAddSubLevel(id) {
        window.radopen("AddCausePopup.aspx?Cause_Id=" + id, "UserListDialog");
        return false;
    </script>
    </telerik:RadCodeBlock>
    --------------------------------------------
    <asp:Panel ID="pnlShowCompany" runat="server">
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behaviors="Close, Move, Reload">
      <Windows>
         <telerik:RadWindow ID="UserListDialog" runat="server" Title="Manage actions" Height="610px"
           Width="575px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" VisibleStatusbar="false" Animation="Fade" />
           </Windows>
            </telerik:RadWindowManager>
              </asp:Panel>
    protected void BtnAddSublevel_Click(object sender, EventArgs e)
        {
    ................
    ............
     Cause_Id = Convert.ToInt32(DtCause1.Rows[0][0].ToString());
    ...............
    ...............
    ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "ShowAddSubLevel(21);", true);
    }
    ---------------------------------------------
    First of all, I am not sure how to pass Cause_Id at ShowAddSubLevel(Cause_Id)??
    and even statically RadWindow is not showing.

    Please help me out.

    Thanks,
    Debasish
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2010 Link to this post

    Hi Debasish,


    A better approach (in your scenario) would be showing the window from code behind instead of calling a client function.

    C#:
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Cause_Id = DtCause1.Rows[0][0].ToString();
        UserListDialog.NavigateUrl = "AddCausePopup.aspx?Cause_Id=" + Cause_Id;
        UserListDialog.VisibleOnPageLoad = true// Set the VisibleOnPageLoad property to True
    }


    If you still want to call the client method, then follow the approach described in the KB Article and pass the parameter to the client method.
    Calling radalert from codebehind


    Do not hesitate to write again if you are experiencing any problem in implementing this.

    Regards,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Varun
    Varun avatar
    13 posts
    Member since:
    Sep 2013

    Posted 13 Nov 2013 Link to this post

    Hi,
    I have apply a master page to rad window....
    In Master Page there is a user control which containg Hyperlink ...
    I want to redirect to plane .aspx page from hyperlink and want to close the radwindow..
    Pls let me know solution for above....


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

    Posted 14 Nov 2013 Link to this post

    Hi Varun,

    Please have a look into the following code snippet to achieve your scenario.

    MasterPage ASPX:
    <telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true">
        <ContentTemplate>
            <uc1:WebUserControl ID="WebUserControl1" runat="server" />
        </ContentTemplate>
    </telerik:RadWindow>

    UserControl Page ASPX:
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/RadAsyncUpload/Detailsingrid.aspx"
        Text="URL" onclick="return closeWin();">
    </asp:HyperLink>

    UserControl Page JavaScript:
    <script type="text/javascript">
        function closeWin() {
            GetRadWindow().close();
        }
        function GetRadWindow() {
            var oWindow = null; if (window.radWindow)
                oWindow = window.radWindow; else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow; return oWindow;
        }
    </script>

    Thanks,
    Shinu
  6. Varun
    Varun avatar
    13 posts
    Member since:
    Sep 2013

    Posted 14 Nov 2013 Link to this post

    Hi Shinu,

    Thanks for ur reply...

    I have used above code... The rad window get closed but it can not redirect to the .aspx page....

    I have used the Use control in Master page .... and master apply to the Rad winow....

     Please see the below code ---

     

    <asp:HyperLink ID="HyLnkSysAcc" runat="server" Font-Underline="True"

    ForeColor="Black" NavigateUrl="~/PRJ/ABC.aspx" onclick="CloseRadwindow();">[HyLnk] </asp:HyperLink>

    function CloseRadwindow()
        {
          var oWindow = null;
          if (window.radWindow)
              oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            oWindow.Close();
            oWindow.BrowserWindow.location.href = '/PRJ/ABC.aspx';  --   if I have remove this line ... The rad window get closed but Navigate functionality fail...     
        }

    your comments pls....

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

    Posted 14 Nov 2013 Link to this post

    Hi Varun,

    The code I posted above is working fine at my end. Are you getting any error on clicking the ASP HyperLink? Can you please elaborate a bit more on what you mean by 'master apply to the RadWindow' along with the full code you tried?

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