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

Open RadWindow from RadGrid Button

1 Answer 366 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 29 Jul 2011, 05:08 PM
i want to open a radwindow from a button in a radgrid. the grid has ajax settings so that it can filter columns and display loading image without postback. However that appears to prevent the radwindow from displaying when a radgrid button is clicked (i think because a postback doesn't occur because i can step through the code that opens the window but the screen doesn't update). If i use a button outside the grid then the window pops up.

so my question is what's the best way to get the window to pop up from a button in the grid and still allow the ajax column filtering? i thought if i could force the buttons in the grid to postback then the window will pop up just like it does with the buttons outside the grid. The client setting EnablePostBackOnRowClick sounds promising but the buttons still aren't causing a postback.

Here's some code in case it helps:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="AccountGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="AccountGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="Center" Transparency="25">
        <div class="loading" style="width:100%; height:100%; background-color:#ddd">
            <img src="./../../images/loading.gif" style="position:relative; top:120px;" />
        </div>
    </telerik:RadAjaxLoadingPanel>

    <asp:Button ID="PopUpWindowButton" runat="server" OnClick="PopUpWindowButton_Click" Text="Pop Up Window" />

    <telerik:RadGrid ID="AccountGrid" runat="server"
        DataSourceID="AccountSqlDataSource" OnItemCommand="AccountGrid_ItemCommand"
        AutoGenerateColumns="false" AllowFilteringByColumn="True" 
        AllowSorting="true" AllowPaging="True" PageSize="15" ShowFooter="True" 
        BorderStyle="Solid">
        <ClientSettings EnablePostBackOnRowClick="true">
        </ClientSettings>
        <GroupingSettings CaseSensitive="false" />
        <AlternatingItemStyle BorderStyle="Solid" />
        <MasterTableView>
            <Columns>
                <telerik:GridButtonColumn Text="Select" CommandName="Select" UniqueName="SelectColumn" ButtonCssClass="ButtonSmGray" AutoPostBackOnFilter="true" />
                <telerik:GridNumericColumn  
                    DataField="AccountID" UniqueName="AccountNumberColumn" HeaderText="Account #"
                    FilterDelay="1000" AutoPostBackOnFilter="true" FilterControlWidth="60" ShowFilterIcon="false">
                </telerik:GridNumericColumn>
                <telerik:GridBoundColumn 
                    DataField="Phone" UniqueName="PhoneColumn" HeaderText="Phone"
                    FilterDelay="1000" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn 
                    DataField="ContactName" UniqueName="NameColumn" HeaderText="Name"
                    FilterDelay="1000" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" FilterControlWidth="70">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn
                    DataField="Address" UniqueName="AddressColumn" HeaderText="Address"
                    FilterDelay="1000" AutoPostBackOnFilter="true" ShowFilterIcon="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn 
                    DataField="City" UniqueName="CityColumn" HeaderText="City"
                    FilterDelay="1000" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn 
                    DataField="State" UniqueName="StateColumn" HeaderText="State"
                    FilterDelay="1000" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn 
                    DataField="DisplayZipCode" UniqueName="ZipColumn" HeaderText="Zip"
                    FilterDelay="1000" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ActiveItemStyle BorderStyle="Solid" />


        <HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu>
    </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Aug 2011, 04:49 AM
Hello Casey,

I tried the same scenario and it worked as expected in my end. Here is the samle code that I tried to open a window from a button click in RadGrid.

C#:
protected void btn_Click(object sender, EventArgs e)
{
     RadWindow window = new RadWindow();
     window .ID = "window1";
     window .VisibleOnPageLoad = true;
     RadWindow1.Controls.Add(window);
}

Thanks,
Princy.
Tags
Grid
Asked by
Casey
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or