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

Problem with RadAlert in Grid

1 Answer 77 Views
Window
This is a migrated thread and some comments may be shown as answers.
Pradeep Enugala
Top achievements
Rank 1
Pradeep Enugala asked on 28 Apr 2010, 11:31 AM
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.

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 30 Apr 2010, 11:32 AM
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.
Tags
Window
Asked by
Pradeep Enugala
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or