Can't Open RadWindow From RadGrid

4 posts, 0 answers
  1. Curt
    Curt avatar
    3 posts
    Member since:
    Jan 2013

    Posted 21 Mar 2013 Link to this post

    I am a complete newbie to RadControls. I have a RadGrid with a GridButtonColumn that is a link button whose text is the data value returned from the database. I have a RadWindowManager with a RadWindow inside of it that then contains a htmlChart. The CommandName on the GridButtonColumn is openWin(); return false;. The full javascript is as follows:

    function openWin() {
        window.radopen(null, "RadWindow2"):
    }

    I also have a RadAjaxManager which I have set the LinkButton to update the RadWindowManager, RadWindow2, and the htmlChart. I have tried all, none, and each individually thinking this was an ajax issue.

    Any help you can offer would be GREATLY appreciated. The next step is how to load the chart....???

    Thanks you though...one step at a time!

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

    Posted 22 Mar 2013 Link to this post

    Hi Curt,

    Try the following code snippet to open the RadWindow from RadGrid.

    C#:
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            LinkButton link = (LinkButton)item["UniqueName"].Controls[0];
            link.OnClientClick = "dispWindow();return false;";
        }
    }

    JavaScript:
    <script type="text/javascript">
        function dispWindow() {
            window.radopen(null, "RadWindow2");
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Curt
    Curt avatar
    3 posts
    Member since:
    Jan 2013

    Posted 22 Mar 2013 Link to this post

    Thank you so much for you response! I had just figured this out last evening. But I have two more issues. The RadWindow I am opening up has an HtmlChart in it that I need to populate. I have to go to the database (serverside). I need to take values from two of the columns from the row the Linkbutton was selected and pass them to a method to get the charts DataSource. I am pretty new to javascript and have no idea how to work this out.

    I tried last night getting the column values in javascript as I open the radwindow, but was unable to do so. Here is the javascript i was using to try and get the variables.Both variables come back null. My guess is my whole approach is incorrect.
    function openWin(sender, args)
            {
                 window.radopen(null, "RadWindow2");
                  var keyValues = 'Org_ID: "' + args.getDataKeyValue("Org_ID") + '"' +
                  'Element Name: "' + args.getDataKeyValue("Element") + '"'; 
                   alert(keyValues); 
                }
    Thank you so much for any help you can provide!
    Curt
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Mar 2013 Link to this post

    Hi,

    You can access the column values using the following javascript.
    JS:
    function openWin(sender, args)
    {
        var masterTable = sender.get_masterTableView();
      var row = masterTable.get_dataItems()[args.get_itemIndexHierarchical()];
     alert(masterTable.getCellByColumnUniqueName(row, "Uniquename").innerHTML);
    }

    Thanks,
    Shinu
Back to Top