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

[Solved] Using a GridButtonColumn to open RadWindow

2 Answers 370 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DogEars
Top achievements
Rank 2
DogEars asked on 25 Feb 2008, 10:01 PM
I looked at one of your samples here and made a minor modification to change what I needed to grab out of the RadGrid.

The project is built around the RowClick event on the client side, but I need to be able to open the RadWindow from a GridButtonColumn or similar using similar javascript. The problem is I don't know how to modify it to make it work so I can use it like I want.

Here is the script I am using currently:

    <script type="text/javascript"
  
    function RowClick(sender, eventArgs) 
    {         
        var MasterTableView = eventArgs.get_tableView();         
        var cell = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "item");    
        var cell2 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "OrdNumb"); 
        var cell3 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "POS");  
        var cell4 = MasterTableView.getCellByColumnUniqueName(MasterTableView.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "HdrBuyFromBP");           
        var oWnd = radopen("Details.aspx?item=" + cell.innerHTML + "&Order_No=" + cell2.innerHTML + "&POS=" + cell3.innerHTML + "&BP=" + cell4.innerHTML ); 
    } 
    </script> 


And when I run and click the imagebutton I am using in the gridbuttoncolumn I get a jscript error of undefined.

Thanks!

2 Answers, 1 is accepted

Sort by
0
DogEars
Top achievements
Rank 2
answered on 26 Feb 2008, 04:28 AM
I have also tried to use the following code behind method to setup the javascript, but I keep getting everything but the 'item' showing up as undefined in the RadWindow.

        If (TypeOf e.Item Is GridDataItem) Then 
            Dim dataitem As GridDataItem = CType(e.Item, GridDataItem) 
            Dim imageButton As ImageButton = CType(dataitem("btnColumn1").Controls(0), ImageButton) 
            Dim myImg As System.Web.UI.WebControls.Image = New System.Web.UI.WebControls.Image 
            myImg.ImageUrl = "images/showstatus.png" 
            
            myImg.Attributes("onclick") = "return ShowEditForm('" + dataitem("item").Text + dataitem("OrdNumb").Text + dataitem("POS").Text + dataitem("HdrBuyFromBP").Text + "');" 
            dataitem("btnColumn1").Controls.Remove(imageButton) 
            dataitem("btnColumn1").Controls.Add(myImg) 
        End If 

0
Missing User
answered on 26 Feb 2008, 03:14 PM
Hello DogEars,

Please find attahced the sample web application that demonstrates the needed approach. Give it a try and let us know if you have other questions or problems.

All the best,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
DogEars
Top achievements
Rank 2
Answers by
DogEars
Top achievements
Rank 2
Missing User
Share this question
or