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

open radwindow in radmenu inside radgrid

4 Answers 114 Views
Window
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 16 Nov 2010, 04:57 AM
I have radmenu inside a template column of a radgrid, there is a radmenuitem with text "New Event". When this particular radmenuitem is clicked i want to open a radwindow. Is this possible to achieve?
thanks in advance

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Nov 2010, 06:13 AM
Hello,


Yea, You can use the client side method to open the radwindow. Attach OnClientItemClicked event to RadMenu and use any of the approach described in the following documentation to open the window.
Opening Windows



-Shinu.
0
sf
Top achievements
Rank 1
answered on 16 Nov 2010, 09:58 AM
thanks Shino for your help
I forgot to mention that i need to pass a value "GridDataItem1["Id"].Text" onto the radwindow, but i am not familiar with client side stuff....

could u please help a bit further?

Edited: I think this should be a question in RadGrid forum, but i couldn't find out how to delete this reply here, and i dont want to creat a duplicate thread in RadGrid forum...  basically I have onClientClicking  method attached to the radmenu onclientclicking event inside the gridtemplatecolumn. This method calls the radopen method. i need to get the  value "GridDataItem1["Id"].Text" inside this method which is required for radopen(), but couldn't figure out how to achieve this .... please

see my code here
var lastClickedItem = null;
        var clickCalledAfterRadprompt = false;
        var clickCalledAfterRadconfirm = false;
        function onClientButtonClicking(sender, args) {
  
            if (args.get_item().get_text() == "Delete") {
                if (!clickCalledAfterRadconfirm) {
                    args.set_cancel(true);
                    lastClickedItem = args.get_item();
                    radconfirm("Are you sure you want to delete this Item?", confirmCallbackFunction);
                }
            }
  
            if (args.get_item().get_text() == "Record Breakdown") {
                    var id = .....
//I am stuck here, I need to find the value in GridDataItem1["Id"] to pass over to the rad open method 
                        radopen(Id);           }
        }
  
        function confirmCallbackFunction(args) {
            if (args) {
                clickCalledAfterRadconfirm = true;
                lastClickedItem.click();
            }
            else
                clickCalledAfterRadconfirm = false;
            lastClickedItem = null;
        }

thanks
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Nov 2010, 12:19 PM
Hello,

You can try the following client side code to achieve your requirement.

JavaScript:
function OnClientItemClicked(sender,args) {
       var cell = sender.get_element().parentNode.parentNode;
       rowindex=cell.rowIndex;//The row index may vary based on the grid structure.
       var grid = $find("<%=RadGrid1.ClientID %>");
       var MasterTable = grid.get_masterTableView();
       var id = MasterTable.get_dataItems()[rowindex - 1].getDataKeyValue("LastName");
       var oWnd = $find("<%=RadWindow1.ClientID%>");
       oWnd.setUrl('MyPage.aspx?ID='+id);
       oWnd.show(); 
   }

Thanks,
Princy.
0
sf
Top achievements
Rank 1
answered on 17 Nov 2010, 03:56 AM
thanks Princy, I have implemented the code it didnt work at first place, after I added this property in the grid master table view it worked fine:

 

 

ClientDataKeyNames="Id"

 

Tags
Window
Asked by
sf
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sf
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or