How do I cause a linkbutton to open page in radwindow?

5 posts, 0 answers
  1. Daniel
    Daniel avatar
    18 posts
    Member since:
    Apr 2011

    Posted 12 May 2011 Link to this post

    I have a series of buttons on a page that are part of a repeater control.  The query string in the navigate URLs gets populated from the database.  What I'd like to do is have the target page open in a radwindow rather than in a standard browser window.

    Below is my aspx code.  Can someone guide me on the changes I need to make to have the target pages open in radwindows? Thanks!


    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
                            <ItemTemplate>
                                <table style="margin-bottom:10px; border-width:1px; border-spacing:2px; border-style:outset; border-color:Gray; border-collapse:separate; border-radius:5px; background-color:White;">
                                    <tr>
                                        <td rowspan="4" style="width:100px; height:100px;">
                                            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/image_upload_icon.png" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:100px;">
                                            Package Name:</td>
                                        <td style="width:390px; padding-left:10px;">
                                            <%#DataBinder.Eval(Container.DataItem, "PackageName") %>
                                        </td>
                                        <td align="right" style="width:100px;">
                                            <telerik:RadButton ID="RadButton3" runat="server" ButtonType="LinkButton"
                                                Height="18px" Image-EnableImageButton="true"
                                                Image-ImageUrl="~/images/remove_icon.png"
                                                NavigateUrl='<%# "removepackage.aspx?ID=" +Eval("PackageID") %>'
                                                Target="_blank" Text="remove" Visible='<%# Eval("RemoveButtonVisible") %>'
                                                Width="18px">
                                            </telerik:RadButton>
                                        </td>
                                    </tr>
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 May 2011 Link to this post

    Hello Daniel,

    As far as I know, the radcontrol functions expects only two default parameters as its arguments, the sender and the arguments. You can try the following try opening the window on the OnClientClicked event and pass the requirted parameters as CommandArguments.
    Here is a sample code.
    aspx:
    <telerik:RadButton ID="RadBtn1" runat="server" Text="OpenWindow" ButtonType="LinkButton" NavigateUrl=""  CommandArgument='<%# "removepackage.aspx?ID=" +Eval("EmployeeID") %>' OnClientClicked="openwindow">
    </telerik:RadButton>
    Javascript:
    function openwindow(senser, args)
        {
           var wnd = $find('<%=GLLookupWindow.ClientID%>');
           alert( args.get_commandArgument());//accessing the Command argument.
           wnd.setUrl(args.get_commandArgument());
           wnd.show();
            . . . . . . . . .
       }

    Thanks,
    Princy.
  3. Daniel
    Daniel avatar
    18 posts
    Member since:
    Apr 2011

    Posted 13 May 2011 Link to this post

    Thanks Princy.  Can you perhaps explain this piece in your javascript? ...<%=GLLookupWindow.ClientID%>

    I don't understand where GLLookupWindow or ClientID is coming from.

    Dan

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

    Posted 16 May 2011 Link to this post

    .
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 May 2011 Link to this post

    Hello Daniel,

    The GLLookupWindow is the ID of the RadWindow. When you are trying to access a RadControl from client side, use $find method.

    aspx:
    <telerik:RadWindow ID="GLLookupWindow" runat="server" Behaviors="Close" Width="900"
                Height="700">
    </telerik:RadWindow>
      <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="false"
                DataSourceID="SqlDataSource1" AutoGenerateEditColumn="true" >
           <MasterTableView Width="100%" DataKeyNames="EmployeeID" CommandItemDisplay="Top"
                    EditMode="EditForms">
           </MasterTableView>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString2 %>"
            SelectCommand="Select * from Employees">
    </asp:SqlDataSource>


    Thanks,
    Princy.
Back to Top