How To Close RadWindow ,Based on user clicks Yes or No buttons

2 posts, 0 answers
  1. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 24 May 2013 Link to this post

    1. This A code Inside in rad grid.all functionalists work properly but at time rad confirm and rad rad prompt  windows are not closed.
    2. <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    3.         <AjaxSettings>
    4.             <telerik:AjaxSetting AjaxControlID="RadGrid1">
    5.                 <UpdatedControls>
    6.                     <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />       
    7.                 </UpdatedControls>
    8.             </telerik:AjaxSetting>
    9.             <telerik:AjaxSetting AjaxControlID="RbtnYes" EventName="Click">
    10.             <UpdatedControls >
    11.              <telerik:AjaxUpdatedControl ControlID="RbtnYes" LoadingPanelID="RadAjaxLoadingPanel1" />
    12.             </UpdatedControls>
    13.             </telerik:AjaxSetting>
    14.             <telerik:AjaxSetting AjaxControlID="RbtnOk" EventName="Click">
    15.              <UpdatedControls >
    16.              <telerik:AjaxUpdatedControl ControlID="RbtnOk" LoadingPanelID="RadAjaxLoadingPanel1" />
    17.             </UpdatedControls>
    18.             </telerik:AjaxSetting>
    19.         </AjaxSettings>
    20.     </telerik:RadAjaxManager>
    21.     <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    22.     </telerik:RadAjaxLoadingPanel>
    23.          <telerik:RadWindow ID="RadWindow" runat="server" VisibleOnPageLoad="false">
    24.              <ContentTemplate>
    25.                     <table>
    26.                         <tr>
    27.                             <td rowspan="2" style="width: 45px;">
    28.                                 <asp:Image ID="image" runat="server"  CssClass="ImgHdAlertCss" />
    29.                             </td>
    30.                             <td>
    31.                                 <asp:Label ID="Label2" runat="server" Text="Do you want to reset your check number ?"
    32.                                     CssClass="Content2Css"></asp:Label>
    33.                             </td>
    34.                         </tr>
    35.                         <tr>
    36.                             <td>
    37.                                 <telerik:RadButton ID="RbtnYes" runat="server" Text="Yes" OnClick="RbtnYes_Click">
    38.                                 </telerik:RadButton>
    39.                                 &nbsp;
    40.                                 <telerik:RadButton ID="RbtnNo" runat="server" Text="No" OnClick="RbtnNo_Click">
    41.                                 </telerik:RadButton>
    42.                             </td>
    43.                         </tr>
    44.                     </table>
    45.               </ContentTemplate>
    46.             </telerik:RadWindow>
    47.          <telerik:RadWindow ID="RadWindow2" runat="server" Behaviors="Default" InitialBehaviors="None"
    48.                 Width="400px" Height="180px"   VisibleOnPageLoad="false" Title="Reset Confirm">
    49.                <ContentTemplate>
    50.                     <table>
    51.                         <tr align="center">
    52.                             <tr>
    53.                                 <td colspan="3">
    54.                                 </td>
    55.                             </tr>
    56.                             <td rowspan="3" style="width: 40px;">
    57.                                 <asp:Image ID="imgChkNopanel" runat="server"
    58.                                     CssClass="ImgHdAlertCss" />
    59.                             </td>
    60.                             <td colspan="3">
    61.                                 <asp:Label ID="lblChkNoPanel" runat="server" Text="Enter another check number." CssClass="Content2Css"></asp:Label>
    62.                             </td>
    63.                         </tr>
    64.                         <tr>
    65.                             <td>
    66.                                 <asp:Label ID="Label7" runat="server" Text="Check No."></asp:Label>
    67.                             </td>
    68.                             <td>
    69.                                 <telerik:RadTextBox ID="RtbChkNumberinInsertMode" runat="server">
    70.                                 </telerik:RadTextBox>
    71.                             </td>
    72.                         </tr>
    73.                         <tr>
    74.                             <td>
    75.                             </td>
    76.                             <td>
    77.                                 <telerik:RadButton ID="RbtnOk" runat="server" Text="OK" OnClick="RbtnOkinInsert_Click">
    78.                                 </telerik:RadButton>
    79.                                
    80.                             </td>
    81.                         </tr>
    82.                     </table>
    83.                 </ContentTemplate>
    84.              </telerik:RadWindow>    
    85.     <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
    86.         <MasterTableView CommandItemDisplay="Top" EditMode="EditForms" AutoGenerateColumns="false">
    87.             <CommandItemSettings ShowAddNewRecordButton="true" />
    88.             <Columns>
    89.                 <telerik:GridButtonColumn ButtonType="ImageButton">
    90.                 </telerik:GridButtonColumn>
    91.                 <telerik:GridTemplateColumn>
    92.                     <InsertItemTemplate>
    93.                         <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" PostbackTriggers="RadButton2">
    94.                         </telerik:RadAsyncUpload>
    95.                     </InsertItemTemplate>
    96.                 </telerik:GridTemplateColumn>
    97.                 <telerik:GridTemplateColumn>
    98.                     <InsertItemTemplate>
    99.                         <telerik:RadTextBox ID="RadTextBox1" runat="server">
    100.                         </telerik:RadTextBox>
    101.                         <telerik:RadButton ID="RadButton1" runat="server" Text="RadButton" OnClick="RadButton1_Click">
    102.                         </telerik:RadButton>
    103.                     </InsertItemTemplate>
    104.                 </telerik:GridTemplateColumn>
    105.                 <telerik:GridTemplateColumn>
    106.                     <InsertItemTemplate>
    107.                         <telerik:RadButton ID="RadButton2" runat="server" Text="RadButton">
    108.                         </telerik:RadButton>
    109.                     </InsertItemTemplate>
    110.                 </telerik:GridTemplateColumn>
    111.             </Columns>
    112.         </MasterTableView>
    113.     </telerik:RadGrid>

    protected void RadButton1_Click(object sender, EventArgs e)
           
    string script = "function f(){$find(\"" + RadWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
           ScriptManager.RegisterStartupScript(Page, Page.GetType(),
    "key", script, true);
     }   
    protected void RbtnYes_Click(object sender, EventArgs e)  
    {  
     
    string script = "function f(){$find(\"" + RadWindow2.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
           ScriptManager.RegisterStartupScript(Page, Page.GetType(),
    "key", script, true);
        }  
    protected void RbtnNo_Click(object sender, EventArgs e)    {    }   
    protected void RbtnOkinInsert_Click(object sender, EventArgs e)<br>   
    {       

    foreach
    (GridEditFormItem item in RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem))
    {
     
    if (item.IsInEditMode)
    {            
    RadTextBox RtbCheckNumber = (RadTextBox)item.FindControl(
    "RadTextBox1");
    RtbCheckNumber.Text =
    "";             
    RtbCheckNumber.Text = RtbChkNumberinInsertMode.Text;          
    }     

    }      
    }



    When  confirmation window  ask user to click on "yes" or "No" button at the time  when user click on "yes"
    I want to show Some confirmation rad window and also at time user click on yes or no i want close the
    "Rad Confirmation" window and also user enter some value  in  textbox and click on Ok .I want close "rad Prompt" window also
    help me telerik team.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 May 2013 Link to this post

    Hi Sairam,

    Try the following code to close the confirmation and prompt windows on corresponding button click.

    C#:
     /*Yes button click*/
    protected void RbtnYes_Click(object sender, EventArgs e)
    {
             /*to close the confirmation window here*/
       string script = "function f(){$find(\"" + RadWindow2.ClientID + "\").show();$find(\"" + RadWindow.ClientID + "\").hide(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
       ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
    }
     /*OK button click*/
    protected void RbtnOkinInsert_Click(object sender, EventArgs e)
    {
     foreach (GridEditFormItem item in RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem))
        {
                  ... ... ...
        }
            /*To hide prompt window on OK click*/
       string script = "function f(){$find(\"" + RadWindow2.ClientID + "\").hide(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
       ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
    }

    Hope this will help you.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top