rad window in grid

9 posts, 1 answers
  1. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 08 Mar 2014 Link to this post

    I have a radgrid displaying user records and an hyperlink . on the click of the hyperlink I want to open up a radwindow which navigates to edituserpermissions page using the userID as a querystring. How can i achieve this. Any help please
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Mar 2014 in reply to Edd Link to this post

    Hi Edd,

    You can take a look at this demo which can help you to achieve your requirement.
    Window Editing

    Thanks,
    Princy


  3. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 11 Mar 2014 Link to this post

    I have seen that demo and doesnt seem to provide my need.
    Anyone to help me please.
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Mar 2014 in reply to Edd Link to this post

    Hi Edd,

    Please have a look into the sample code snippet which works fine at my end.

    Parent Page ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnItemCreated="RadGrid1_ItemCreated">
        <MasterTableView DataKeyNames="OrderID" ClientDataKeyNames="OrderID">
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <asp:HyperLink ID="Link1" runat="server" Text="Edit"></asp:HyperLink>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="RadWindow" runat="server">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>

    Parent Page C#:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            HyperLink editLink = (HyperLink)e.Item.FindControl("Link1");
            editLink.Attributes["href"] = "javascript:void(0);";
            editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}');",                                  e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["OrderID"]);
        }
    }

    Parent Page JavaScript:
    <script type="text/javascript">
        function ShowEditForm(id, rowIndex) {
            var grid = $find("<%= RadGrid1.ClientID %>");
            window.radopen("window.aspx?OrderID=" + id);
        }
    </script>

    Child Window Page ASPX:
    <telerik:RadTextBox ID="RadTextBox2" runat="server" Label="OrderID">
    </telerik:RadTextBox>

    Child Window Page C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        string value = Request.QueryString["OrderID"]; // access the querystring value
        RadTextBox2.Text = value; // assigning that value to the textbox
    }

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Princy.
  5. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 19 Mar 2014 in reply to Princy Link to this post

    Thanks princy,

    What i am looking to achieve is this. When i click the hyper link I want to pop up a radwindow which contains another webpage called edituserpermissions. So the problem am facing now is how can i use the UserID as a querystring in the edituserpermissions page.
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Mar 2014 in reply to Edd Link to this post

    Hi Edd,

    You can access the QueryString variable in 'edituserpermissions' page as follows.

    JavaScript:
    function ShowEditForm(id, rowIndex) {
            var grid = $find("<%= RadGrid1.ClientID %>");
            window.radopen("edituserpermissions.aspx?UserID =" + id);
        }

    edituserpermissions.aspx.cs:
    string value = Request.QueryString["UserID"];//holds the QueryString Variable

    Thanks,
    Princy.
  7. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 21 Mar 2014 in reply to Princy Link to this post

    Hi Princy,
    Thanks for your support. Below is what i have been able to do so far, but the problem now is that when i click on the link the radwindow pop up with the current page but not the intended page and again how do i pass the querystring too.
    Thanks always

    aspx page

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0"
                                  DataSourceID="SqlDataSourceSearchResults" GridLines="None" Skin="Hay" AllowAutomaticUpdates="True" AllowMultiRowEdit="True"
                                 AllowMultiRowSelection="True" ShowFooter="True" OnItemCommand="rdgSampleGrid_ItemCommand">
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                <Selecting AllowRowSelect="True" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" EnableVirtualScrollPaging="false" />
            </ClientSettings>
             <GroupingSettings CaseSensitive="false"></GroupingSettings>
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="sessID" DataSourceID="SqlDataSourceSearchResults" EditMode="InPlace" PageSize="50" CommandItemDisplay="TopAndBottom">
     
    <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False"></CommandItemSettings>
     
    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
     
    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True"></ExpandCollapseColumn>
     
                <Columns>
                  <%--   <telerik:GridButtonColumn CommandName="Select" FilterControlAltText="Filter column column" Text="View Video" UniqueName="column" ItemStyle-Width="80px" HeaderStyle-Width="80px">                     
                           </telerik:GridButtonColumn>--%>
                  <telerik:GridBoundColumn DataField="Luno" FilterControlAltText="Filter Luno column" HeaderText="Luno" SortExpression="Luno" UniqueName="Luno" FilterControlWidth="70" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true">
                   <ColumnValidationSettings>
                           <%-- <ModelErrorMessage Text="" />--%>
                        </ColumnValidationSettings>
                              <HeaderStyle Width="80px" />
                <ItemStyle Width="80px" />
                        </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="sessID" FilterControlAltText="Filter sessID column" HeaderText="Session ID" SortExpression="sessID" UniqueName="sessID" ReadOnly="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="120px">
                        <ColumnValidationSettings>
                           <%-- <ModelErrorMessage Text="" />--%>
                        </ColumnValidationSettings>
                              <HeaderStyle Width="150px" />
                <ItemStyle Width="150px" />
                    </telerik:GridBoundColumn>
                    
                        <telerik:GridDateTimeColumn DataField="Start" PickerType="DatePicker" FilterControlAltText="Filter Start column" HeaderText="Start" SortExpression="Start" UniqueName="Start" CurrentFilterFunction="Contains" ReadOnly="true" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="140px" AllowFiltering="false">
                        <ColumnValidationSettings>
                          <%--  <ModelErrorMessage Text="" />--%>
                        </ColumnValidationSettings>
                         <HeaderStyle Width="150px" />
                <ItemStyle Width="150px" />
                    </telerik:GridDateTimeColumn>
                    
               <telerik:GridDateTimeColumn DataField="EndD" PickerType="DatePicker" FilterControlAltText="Filter EndD column" HeaderText="EndD" SortExpression="EndD" UniqueName="EndD" ReadOnly="true" AutoPostBackOnFilter="false" ShowFilterIcon="false" FilterControlWidth="140px" AllowFiltering="false">
                        <ColumnValidationSettings>
                           <%-- <ModelErrorMessage Text="" />--%>
                        </ColumnValidationSettings>
                          <HeaderStyle Width="150px" />
                <ItemStyle Width="150px" />
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="PAN1" FilterControlAltText="Filter PAN1 column" HeaderText="PAN" SortExpression="PAN1" UniqueName="PAN1" ReadOnly="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="110px" >
                        <ColumnValidationSettings>
                            <%--<ModelErrorMessage Text="" />--%>
                        </ColumnValidationSettings>
                           <HeaderStyle Width="120px" />
                <ItemStyle Width="120px" />
                    </telerik:GridBoundColumn>
                     <telerik:GridButtonColumn Text="video" ButtonType="ImageButton" UniqueName="OpenWindow" CommandName="window">
                          <HeaderStyle Width="40px" />
                <ItemStyle Width="40px" />
                        </telerik:GridButtonColumn>
                </Columns>
     
    <EditFormSettings>
    <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
    </EditFormSettings>
            </MasterTableView>
     
    <FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>

    code behind
    protected void rdgSampleGrid_ItemCommand(object sender, GridCommandEventArgs e)
          {
              if (e.CommandName == "window")
              {
                  //Create Radwindow object
                  RadWindow win = new RadWindow();
                  //Set id for radwindow
                  win.ID = "window1";
                  win.Height= 500;
                  win.Width = 1300;
     
                  win.VisibleOnPageLoad = true;
                  //Here you should get your value and pass it to other page as a Query string
                  win.NavigateUrl = "video.aspx?sessID";
                  //Add the Radwindow to window manager
                  RadWindowManager1.Controls.Add(win);
              }
          }



  8. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Mar 2014 in reply to Edd Link to this post

    Hi Edd,

    Please do the following modifications in your C# code which works fine at my end.

    C#:
    win.NavigateUrl = "video.aspx?sessID=" + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"];

    Thanks,
    Princy.
  9. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 24 Mar 2014 in reply to Princy Link to this post

    Thanks Princy, it worked perfectly for me.
Back to Top