Search code examples
javascriptasp.nettelerikradgridradwindow

Multiple radGrids with radWindows


I have 3 radGrids in 1 page and I want to popUP a radWindow for every one when I double click on a row.

I use this 2 javascript function:

function RowDblClick(sender, eventArgs) {
            alert("it was dblclicked");
            sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            alert("pass rowdbl");
        }

function onPopUpShowing(sender, args) {
            alert("reach onPopUpShowing");
            args.get_popUp().className += " popUpEditForm";
        }

I make the radGrids and at Client setting I put the functions:

<ClientSettings>
    <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
</ClientSettings>

The problem is that for first Grid it Opens the RadWindow , but for the next 2 it doesn't reach the OnPopUpShowing function

In code behind I write this in Page_Load:

protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
            rdCompanyUsers.MasterTableView.EditMode = GridEditMode.PopUp;
            rdRights.MasterTableView.EditMode = GridEditMode.PopUp;
            rdDivision.MasterTableView.EditMode = GridEditMode.PopUp;}

Can somebody help me with this issue?


Solution

  • Using your exact javascript and the markup below all functionality is what you were trying to achieve. The only difference is not setting the properties on the grid in Page_Load. What you showed should work just fine, though. I suspect there are inconsistencies between your grid declarations or perhaps your datasources have issues.

    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" DataSourceID="sdsGrids">
            <MasterTableView EditMode="PopUp"></MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="true" DataSourceID="sdsGrids">
            <MasterTableView EditMode="PopUp"></MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadGrid ID="RadGrid3" runat="server" AutoGenerateColumns="true" DataSourceID="sdsGrids">
            <MasterTableView EditMode="PopUp"></MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="onPopUpShowing" />
            </ClientSettings>
        </telerik:RadGrid>
    </div>
        <asp:SqlDataSource ID="sdsGrids" runat="server" ConnectionString="..." SelectCommand="SELECT * FROM ..."></asp:SqlDataSource>
    </form>