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

Display message box on Radgrid Save button click.

4 Answers 555 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bhanu
Top achievements
Rank 1
Bhanu asked on 02 Aug 2010, 06:11 PM
Hi,

Iam configuring the below grid and I have to display  "Yes / No" message box on Save & Cancel Click.
Based on user response I have to display few more "Ok" message box & few more "Yes / No" message boxes.
Can you please explain how to achieve this functionality in radgrid ?
Your help is very much appreciated. Thank you.


OrderTypeRankingGrid.AddNeedDataSourceEventHandler(NeedDataSource); // Binding master table view
            OrderTypeRankingGrid.AddGridCommandEventHandler(DataGrid_ItemCommand); // Events for the standard ngm controls
            OrderTypeRankingGrid.PreRender += new EventHandler(OrderTypeRankingGrid_PreRender);
                       
             
            OrderTypeRankingGrid.AllowColumnsReorder = false;             
            OrderTypeRankingGrid.GridHeaderText = "Order Type Ranking"; 
            var masterView = OrderTypeRankingGrid.ConfigureMasterTableView("vDivisionOrderTypeRanking", new string[] { "DivisionOrderTypeRankId","CategoryCode", "PurposeCode", "ReasonCode", "ReasonDescription"});
            masterView.AllowFilteringByColumn = true;
            masterView.AllowSorting = true;
            masterView.FullEditMode = true;
            masterView.EditMode = GridEditMode.InPlace;
            masterView.EnableShowHideColumns = true;
            masterView.SetPaging(GridPagerMode.NextPrevAndNumeric);
            masterView.GridTableView.ShowHeader = true;
            masterView.ShowHeader = true;
            masterView.ShowFooter = true;
            masterView.ShowHeadersWhenNoRecords = true;
            masterView.AllowPaging = true;
            masterView.PageSize = 10;
              
                          
            masterView.AddNgmCommandButton(NgmButtonType.Save, "btnSave", null, null, null, Unit.Pixel(50));
            masterView.AddNgmCommandButton(NgmButtonType.Cancel, null, null, null, null, Unit.Pixel(50));
              
            masterView.CommandItemDisplay = GridCommandItemDisplay.Bottom;
  
              
            if (!IsPostBack)  //must check for postback; otherwise, columns will be duplicated
            {
                //masterView.AddBoundColumn("DivisionOrderTypeRankId", "Rank ID", "DivisionOrderTypeRankId", true, false, true, Unit.Percentage(7.0));
                masterView.AddBoundColumn("CategoryCode", "Category Code", "CategoryCode", true, false, true, Unit.Percentage(7.0));
                masterView.AddBoundColumn("PurposeCode", "Purpose Code", "PurposeCode", true, false, true, Unit.Percentage(7.0));
                masterView.AddBoundColumn("ReasonCode", "Reason Code", "ReasonCode", true, false, true, Unit.Percentage(7.0));
                masterView.AddBoundColumn("ReasonDescription", "Reason Description", "ReasonDescription", true, false, true, Unit.Percentage(7.0));
                masterView.AddBoundColumn("OrderTypeRank", "Rank", "OrderTypeRank", false, false, true, Unit.Percentage(7.0));
                  
            }

I have the below code in my .aspx page.

<telerik:RadScriptManager ID="RadScriptManager2" runat="server">
        </telerik:RadScriptManager>
  
//Customized Radgrid Datagrid usercontrol
<tr> <uc1:DataGrid ID="OrderTypeRankingGrid" runat="server" />  </tr>
  
  
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="radGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radGrid" />
                    <telerik:AjaxUpdatedControl ControlID="lblBindTime" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnExport">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radGrid" />
                    <telerik:AjaxUpdatedControl ControlID="btnExport" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnExportMultilevelGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radGrid" />
                    <telerik:AjaxUpdatedControl ControlID="btnExportMultilevelGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <ClientEvents OnRequestStart="RequestStarted" OnResponseEnd="ResponseEnd" />
    </telerik:RadAjaxManager>

4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 05 Aug 2010, 12:32 PM
Hello Bhanu,

Please check out the following online resources:
http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx
http://www.telerik.com/community/code-library/aspnet-ajax/window/customizing-the-radconfirm-dialog.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdconfirmationdialogs.html

I hope this helps.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bhanu
Top achievements
Rank 1
answered on 05 Aug 2010, 04:52 PM
Hi,

I have a radgrid and radgrid columns & Save & Cancel buttons are added programmatically in .aspx.cs file (not in .aspx).

Here are my scenarios.

1. When user clicks on "Cancel" button, Iam executing one function in .aspx.cs file which will return a bool value and if that is true then 
     I have to display "OK/Cancel" confirmation, not directly on Click event of the Cancel button. How to capture what User clicked -
     Ok or Cancel ?  Based on this I will have to execute other functions.

2. When user clicks on "Save" button, Iam executing another function in .aspx.cs file which will return a value and based on that value
     I have to display "Ok/Cancel" confirmation, not directly on click event of the Save button.  How to capture what User clicked -
     Ok or Cancel ?  Based on this I will have to execute other functions.

You can refer to the above code.

0
Bhanu
Top achievements
Rank 1
answered on 07 Aug 2010, 08:09 PM
Any update on this please ?
0
Radoslav
Telerik team
answered on 10 Aug 2010, 12:53 PM
Hi Bhanu,

On server side click event handler or RadGrid.ItemCommand event handler you could call javascript function through ScriptManager.RegisterStartupScript method. For example:
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "openWindow", "ShowRadConfirm()", true);

Additionally you could check out the following online example which demonstrates how to use the confirm dialog:
http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx

I hope this helps.

Regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Bhanu
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Bhanu
Top achievements
Rank 1
Share this question
or