Problem with RadAlert in Grid

2 posts, 0 answers
  1. Pradeep Enugala
    Pradeep Enugala avatar
    55 posts
    Member since:
    Apr 2010

    Posted 28 Apr 2010 Link to this post

    Dear Telerik Team,

    I have a page with RadGrid control which has some bound columns and GridButton column which is for delete (having inner) item in grid. Open a popup when click on command item link button and it has a tabstrip which has three tabs. In third tab we have a grid which has to ask radconfirm on OnClient event when click on Generate command item Link button. If OK it has to fire event and do some operation. I tried with all the ways from the articles,forum and documentation source but i didn't. At last i tried with the below script which is working fine but i am unable to fire Delete in Grid.

    <script language="javascript" type="text/javascript">     
            var oldConfirm = radconfirm;        
            window.radconfirm = function(text, mozEvent, oWidth, oHeight, callerObj, oTitle)        
            {        
                var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually        
                //Cancel the event        
                ev.cancelBubble = true;        
                ev.returnValue = false;        
                if (ev.stopPropagation) ev.stopPropagation();        
                if (ev.preventDefault) ev.preventDefault();        
                        
                //Determine who is the caller        
                var callerObj = ev.srcElement ? ev.srcElement : ev.target;        
           
                //Call the original radconfirm and pass it all necessary parameters        
                if (callerObj)         
                {        
                    //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.        
                    var callBackFn = function (arg)        
                    {                   
                        if (arg)        
                        {                   
                            callerObj["onclick"] = "";                  
                            if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz        
                            else if (callerObj.tagName == "A") //We assume it is a link button!        
                            {                                                               
                                try       
                                {        
                                    eval(callerObj.href)        
                                }        
                                catch(e){}        
                            }        
                        }        
                    }        
        
                    oldConfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle);      
                }        
                return false;        
            }       
        </script>   
    Can you please go through this issue and give me a better solution.
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 30 Apr 2010 Link to this post

    Hi Pradeep,

    The "blocking radconfirm" logic that you posted works in certain scenarios only. What I would suggest in your case is to use the original radconfirm() function - you could use the client callback function to fire a custom command for the grid.
    e.g. in the client callback function:
    $find("<%=RadGrid1.ClientID%>").get_masterTableView().fireCommand("MyCustomCommand",itemIndex);
    Then, in the RadGrid.CommandItem event handler, you can executed different code based on the received ArgumentName.



    Sincerely yours,
    Georgi Tunev
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top