I am having a Grid view where I will have a column with Status Y/N. If the status is N I will show a Pop up saying do you want to approve, If ok was pressed I would like to return true from Javascript and need to update my table and allow user to edit the details if cancel I would like to return false from Javascript and make edit false.
This is my script
In my ItemDatabound I will have some code that will check for N . If found I will show a pop up as follows
From here I would like to return true/false from script so that if true I will update my table if not I will make edit to false.
                                This is my script
<script language="javascript" type="text/javascript">        function confirmCallBackFn(arg) {            if (arg == true) {                //should retun true            }            if (arg == false) {                //should retun false            }        }      </script>In my ItemDatabound I will have some code that will check for N . If found I will show a pop up as follows
rdwndwPersonal.RadConfirm("Are you sure?", "confirmCallBackFn", 300, 100, null, "My Confirm");From here I would like to return true/false from script so that if true I will update my table if not I will make edit to false.
8 Answers, 1 is accepted
0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                 Rank 2
                Rank 2
            
    
                                                
                                                answered on 22 Aug 2012, 12:25 PM
                                            
                                        Hi Dorababu,
You can pass the response from the RadConfirm using AjaxRequest.Here is the code snippet I tried.
ASPX:
Javascript:
C#:
Thanks,
Shinu.
                                        You can pass the response from the RadConfirm using AjaxRequest.Here is the code snippet I tried.
ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  <AjaxSettings>       <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">            <UpdatedControls>                  <telerik:AjaxUpdatedControl ControlID="RadGrid1" />            </UpdatedControls>        </telerik:AjaxSetting>    </AjaxSettings></telerik:RadAjaxManager><telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>Javascript:
function confirmCallBackFn(arg) {  var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>");  if (arg)   {      ajaxManager.ajaxRequest('true');  }  else  {     ajaxManager.ajaxRequest('false');  }}C#:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e){    if (e.Argument.ToString() == "true")    {        //your code      }    else    {       //your code    }}Thanks,
Shinu.
0
                                
                                                    Dorababu
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 22 Aug 2012, 12:29 PM
                                            
                                        Hi thanks for your reply but I would like get Boolean value RadGrid2_ItemDataBound event . This is my code
 
                                        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)    {        int iPagecount = RadGrid2.MasterTableView.CurrentPageIndex;        if (e.Item is GridDataItem)        {            if (iPagecount == 0)            {                if (e.Item.ItemIndex != 0)                {                    GridDataItem item = (GridDataItem)e.Item;                    ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];                    imageButton.Visible = false;                }                else                {                    GridDataItem item = (GridDataItem)e.Item;                    ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];                    imageButton.Visible = true;                }            }            else            {                GridDataItem item = (GridDataItem)e.Item;                ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];                imageButton.Visible = false;            }        }        if (e.Item is GridEditableItem && e.Item.IsInEditMode)        {            int radGridClickedRowIndex;            GridEditableItem item = e.Item as GridEditableItem;            radGridClickedRowIndex = item.ItemIndex;            string status = item.GetDataKeyValue("ApprovalStatus").ToString();            if (status == "Y")            {                if (!e.Item.OwnerTableView.IsItemInserted)                {                    RadDatePicker radDtStartDate = item.FindControl("radDtStartDate") as RadDatePicker;                    RadDatePicker radDtEndDate = item.FindControl("radDtEndDate") as RadDatePicker;                    DateTime dtTimestamp = Convert.ToDateTime(item.GetDataKeyValue("timestampfield").ToString());                    oldTimeStamp = dtTimestamp.ToString("yyyy-MM-dd HH:mm:ss");                    strDate = radDtStartDate.SelectedDate.Value;                    EndDt = radDtEndDate.SelectedDate.Value;                }            }            else            {                rdwndwPersonal.RadConfirm("Are you sure?", "confirmCallBackFn", 300, 100, null, "My Confirm");// Here I would like to get the result on selecting Ok and Cancel if Ok I would like to do some code if not I will set edit for grid as false            }        }    }0
                                
                                                    Dorababu
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 25 Aug 2012, 05:14 AM
                                            
                                        Can some one help me please I got struck here
                                        0
                                Hello Dorababu,
Please note that acquiring a user answer on the ItemDataBound event is not possible due to early execution before rendering.
I have created a sample RadGrid web site where I implemented the requested functionality by keeping the non-approved items' indexes in a List Session. If the user approves the item, the text becomes "Y"- here you will need to do your custom update operation to preserve the approval. Else if the user refuse to approve the item, it goes in Edit mode.
I hope this will prove helpful. Please check out the attached application and let me know about the result.
Kind regards,
Eyup
the Telerik team
                                        Please note that acquiring a user answer on the ItemDataBound event is not possible due to early execution before rendering.
I have created a sample RadGrid web site where I implemented the requested functionality by keeping the non-approved items' indexes in a List Session. If the user approves the item, the text becomes "Y"- here you will need to do your custom update operation to preserve the approval. Else if the user refuse to approve the item, it goes in Edit mode.
I hope this will prove helpful. Please check out the attached application and let me know about the result.
Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
                                0
                                Hi Dorababu,
You could rename the command name as you wish and then check in the ItemCommand server event if it has been fired.
Could you please verify whether the provied web site in my previous post works as expected?
Regards,
Eyup
the Telerik team
                                        You could rename the command name as you wish and then check in the ItemCommand server event if it has been fired.
Could you please verify whether the provied web site in my previous post works as expected?
Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
                                
                                                    Dorababu
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 29 Aug 2012, 08:26 AM
                                            
                                        Thanks for your reply, but you didn't have written any command event in your code that you have given
                                        0
                                Hello Dorababu,
It is a custom command name ( for example "YourAffirmativeCommand" ) which then is used to determine the command which has been raised by RadGrid's MasterTableView. Please check out the ItemCommand event handler on the code-behind of the provided web site.
Kind regards,
Eyup
the Telerik team
                                        It is a custom command name ( for example "YourAffirmativeCommand" ) which then is used to determine the command which has been raised by RadGrid's MasterTableView. Please check out the ItemCommand event handler on the code-behind of the provided web site.
Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
