radwindow with a grid inside

7 posts, 0 answers
  1. Jols
    Jols avatar
    69 posts
    Member since:
    Mar 2009

    Posted 20 Mar 2009 Link to this post

    hello to all,

                    i would like to  ask from  you who are expert in telerik control, coz i wanted to use a radwindow control, anyway here's my question.. when the user click the show grid button, another window will popup with a grid inside plus the values of every column load from the database. how can i do that.

    sample codes is highly appreciated

    thanks to all 
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Mar 2009 Link to this post

    Hi Joles,

    Open RadWindow from the parent page by clicking on the button. For this set the OpenerElementId as ID of the button. Add RadGrid in the page which you want to open in RadWindow (with database connections set). Set the NavigateUrl of RadWindow to the second page.

    Parent page ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
        <Windows> 
            <telerik:RadWindow runat="server" Behavior="Default" InitialBehavior="None" Left="" 
                NavigateUrl="Window.aspx" OpenerElementID="Button1" Style="display: none;" Top=""
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 
    <input id="Button1" type="button" value="Show Grid" /> 

    ASPX of Page showing in RadWindow (Window.aspx):
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1">           
            <MasterTableView DataSourceID="SqlDataSource1" EditMode="InPlace"
                   <Columns> 
                      . . .  
                   </Columns> 
            </MasterTableView>            
    </telerik:RadGrid> 
     
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:NorthwindConnectionString2 %>" 
                SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]" OnUpdating="SqlDataSource1_Updating"
    </asp:SqlDataSource> 

    Checkout the following links for more information about opening windows and passing parameters to RadWindow, instead of using OpenerElementID.
    Opening Windows
    Window / Using the URL for Server Arguments

    Thanks,
    Shinu.
  3. Jols
    Jols avatar
    69 posts
    Member since:
    Mar 2009

    Posted 22 Mar 2009 Link to this post

    sir shinu,

                  thank you much  its works, sir question again how can i pass a parameter value to the grid within the radwindow, i have two parameter value namely accoutnumber and the cardnumber and their datatype is int, and also sir how can format that value in the session.


    Once again thank you

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

    Posted 23 Mar 2009 Link to this post

    Hello Jols,

    The easy way to pass parameters is to supply query string parameters to the window URL. I used radopen() for opening the RadWindow instead of using OpenerElementID in order to pass the parameter to RadWindow by setting the Url. These parameters can be read on the server in the Page_Load method of the page being loaded in the window.

    In the main window I have:
    <telerik:radwindowmanager id="RadWindowManager1" runat="server" DestroyOnClose="true"
    </telerik:radwindowmanager> 
    <asp:TextBox ID="TextBox1" runat="server" Text="Account Number"></asp:TextBox> 
    <asp:TextBox ID="TextBox2" runat="server" Text="Card Number"></asp:TextBox> 
    <input id="Button1" type="button" value="Open Window" onclick="openRadWindow();" /> 

    JavaScript:
    <script type="text/javascript"
    function openRadWindow() 
        var accNumber= document.getElementById("TextBox1").value; 
        var cardNumber= document.getElementById("TextBox2").value; 
        var oWnd = radopen("Window.aspx?accoutnumber=" +accNumber + '&cardnumber=' + cardNumber, "RadWindow1" );  // Set the url 
        oWnd.center(); 
    </script> 

    In the Second page (opening in RadWindow)
    CS:
    protected void Page_Load(object sender, EventArgs e) 
        int accoutnumber = Convert.ToInt32(Page.Request.QueryString["accoutnumber"]); 
        int cardnumber = Convert.ToInt32(Page.Request.QueryString["cardnumber"]); 
    Using the URL Query String to Provide Arguments to RadWindow

    Thanks,
    Shinu.
  5. Jols
    Jols avatar
    69 posts
    Member since:
    Mar 2009

    Posted 23 Mar 2009 Link to this post

    sir Shinu,

                  Wow sir shinu it works, thank you so much, sir hehehehe another one i tried to use asp button here it wont work i dont know what happen what the difference with  HTMLinput button to asp button sir. coz i want to disable first the button  who handle the to show the radwindow. before i forgot how to set the skin for the radwindow in javascript?

    my asp button when executed it wont work how can i fix it?;

    <

     

    asp:Button ID="BtnSave" runat="server" Text="Save and Create Request" Width="171px" Font-Names="Tahoma" Font-Size="10pt" OnClick="openRadWindow();" /></td>

     



    sample/codes is highly appriciated
  6. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 23 Mar 2009 Link to this post

    Hello Jols,

    You can open any .aspx page in the RadWindow control by using one of these approaches. You should just add the grid in the content page and setup it as in a standard web page.
    If  you need to use the RadGrid control you could check this help page and this demo page for more information.

    Sincerely yours,
    Fiko
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. rmh
    rmh avatar
    4 posts
    Member since:
    Dec 2007

    Posted 10 Sep 2009 Link to this post

    I noticed than when the necessity of passing querystring values arose, Shinu replaced having a RadWindow with a NavigateUrl with opening the window in javascript using window.radopen(). Is it possible to have a RadWindow defined with placeholder querystring values in the NavigateUrl to be filled later?

    I want to have a RadWindow that I can still open using this code but somehow pass a value to the {0}.
    <telerik:RadWindow runat="server" ID="OpenWindow" NavigateUrl="~/Open.aspx?id={0}" /> 
    window.radopen( null"OpenWindow" ); 

    I have been using the window.radopen() method exclusively, passing in the url and filling in the querystring values there. The problem was that my usercontrol is used in pages on several directory levels, so the paths don't always work. I can't use absolute URLs since I don't know the host/domain at design time, so I thought I could try to use a RadWindow instead since it can handle using the ~ notation for URLs.

    Any thoughts on how I could A) format the navigateurl string set in the RadWindow when the javascript is called, or B) find a better workaround to the issue of getting the URLs to work regardless of the directory the page is in?


Back to Top