This is a migrated thread and some comments may be shown as answers.

Can't Open RadWindow From RadGrid

3 Answers 72 Views
Window
This is a migrated thread and some comments may be shown as answers.
Curt
Top achievements
Rank 1
Curt asked on 21 Mar 2013, 07:41 PM
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!

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Mar 2013, 06:13 AM
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.
0
Curt
Top achievements
Rank 1
answered on 22 Mar 2013, 01:54 PM
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
0
Shinu
Top achievements
Rank 2
answered on 25 Mar 2013, 12:23 PM
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
Tags
Window
Asked by
Curt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Curt
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or