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

Radwindow is not opening at button column click event in RadGrid

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jessy Joseph
Top achievements
Rank 1
Jessy Joseph asked on 05 Apr 2011, 04:34 PM

I have a Radgrid with button column when I click the button the first time the Radwindow does not open, but it opens on the second click on the same button. I have tried every possible solution in RadAjax but still facing the same problem. I am using Masterpage in this project.

Following are my code in Javascript,Client side and Server side.

//Javascript Code

 
  
function ShowUPExc(partnerid) {
  
                window.radopen("Update.aspx?PartnerID=" + partnerid , "rwUpdateExc");
                return false;
                }

//Client Side Code
  
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgExc">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgExc" />
                    <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>   
  
<telerik:RadGrid ID="rgExc" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                                                    AllowSorting="True" DataSourceID="dsExclusion" GridLines="None" Skin="Outlook"
                                                    Width="100%" ShowGroupPanel="False" AutoGenerateColumns="False" PageSize="2"
                                                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                                                    ShowHeader="true" OnItemDataBound="rgExc_ItemDataBound" OnItemCommand="rgExc_ItemCommand">
                                                    <HeaderContextMenu>
                                                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                                    </HeaderContextMenu>
                                                    <FilterMenu>
                                                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                                    </FilterMenu>
                                                    <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
                                                    <MasterTableView DataSourceID="dsExclusion" DataKeyNames="ExcType, StartDate, EndDate"
                                                        PageSize="2" Width="100%" GroupLoadMode="Client" EnableNoRecordsTemplate="true"
                                                        ShowHeadersWhenNoRecords="true" AllowFilteringByColumn="false" AllowMultiColumnSorting="false"
                                                        EnableHeaderContextMenu="false">
                                                         
                                                        <Columns>
                                                            <telerik:GridBoundColumn DataField="ExcType" HeaderText="Exc Type" SortExpression="ExcType"
                                                                UniqueName="ExcType" ReadOnly="True" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true"
                                                                ShowFilterIcon="false" FilterDelay="4000" Groupable="false" FilterControlWidth="120px"
                                                                HeaderStyle-Width="140px">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridDateTimeColumn DataField="StartDate" DataType="System.DateTime" HeaderText="Start Date"
                                                                SortExpression="StartDate" UniqueName="StartDate" AutoPostBackOnFilter="true"
                                                                PickerType="DateTimePicker" FilterControlWidth="150px" ItemStyle-Wrap="false"
                                                                HeaderStyle-Width="170px">
                                                            </telerik:GridDateTimeColumn>
                                                            <telerik:GridDateTimeColumn DataField="EndDate" DataType="System.DateTime" HeaderText="End Date"
                                                                SortExpression="EndDate" UniqueName="EndDate" AutoPostBackOnFilter="true" PickerType="DateTimePicker"
                                                                FilterControlWidth="150px" ItemStyle-Wrap="false" HeaderStyle-Width="170px">
                                                            </telerik:GridDateTimeColumn>
                                                            <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false"
                                                                HeaderStyle-Width="120px">
                                                                <ItemTemplate>
                                                                    <asp:Button ID="btnUpdate" runat="server" Text="Update" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex")%>'
                                                                        CommandName="UpdateExc" />
                                                                </ItemTemplate>
                                                            </telerik:GridTemplateColumn>
                                                        </Columns>
                                                    </MasterTableView>
                                                    <ClientSettings AllowColumnsReorder="False" AllowDragToGroup="False" ReorderColumnsOnClient="False"
                                                        EnableRowHoverStyle="true" EnablePostBackOnRowClick="true" AllowKeyboardNavigation="true">
                                                        <Resizing AllowColumnResize="False" EnableRealTimeResize="False" ResizeGridOnColumnResize="False"
                                                            AllowResizeToFit="true" />
                                                        <Selecting AllowRowSelect="True" />
                                                        <Scrolling AllowScroll="False" UseStaticHeaders="False" SaveScrollPosition="False">
                                                        </Scrolling>
                                                    </ClientSettings>
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                </telerik:RadGrid>
  
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"
        Skin="Office2007">
        <Windows>
            <telerik:RadWindow ID="rwUpdateExc" runat="server" ShowContentDuringLoad="false"
                ReloadOnShow="true" Title="Update Exclusion Window" Width="750px" Height="350px"
                VisibleStatusbar="false" Modal="true" ToolTip="Update Exclusion">
            </telerik:RadWindow>
             
        </Windows>
    </telerik:RadWindowManager>

//Server Side Code
  
protected void rgExclusion_ItemCommand(object source, GridCommandEventArgs e)
    {
if (e.CommandName == "UpdateExc")
        {
            string strEType;
  
            strEType = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ExcType"].ToString();
  
            if (strEType == "Partner")
            {
                Button btnUExc = (Button)e.Item.FindControl("btnUpdate");
                btnUExc.Attributes["href"] = "#";
                btnUExc.Attributes["onclick"] = String.Format("return ShowUPExc('{0}');", Session["PGEPartnerID"].ToString());
           }
}   
      
}  

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Apr 2011, 10:38 AM
Hello Jessy,

To use the RadAjaxManager control in integration with a RadWindow as demonstrated in thisDemo you should use a separate RadWindow control and not to wrap it in a RadWindowManager.

Hope it will help,
Princy.
Tags
Grid
Asked by
Jessy Joseph
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or