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

how to use onclick and onclientlient in conjunction

1 Answer 67 Views
Window
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 19 Nov 2008, 01:15 AM
heya.
Trying to achieve a couple things.
Load up radwindow and display details (check)
'notes' field textbox and button in radwindow (check)
button click events set as so... 

 

<asp:Button ID="btnCancel" OnClick="btnCancel_Click" OnClientClick="CloseWindow(); return false;" runat="server" Text="Cancel" />
problem is that the page is closing before the data update is taking place..
Also... I would prefer if i could get the grid that launched the radwindow via gridItemTemplate to rebind.. otherwise rebind the whole page.
code below
Parent aspx code:

 

 

 

function cancelPost(recordid)  
 
{  
 
var oWnd = radopen("Ctrls/Leaders/cancelposting.aspx?RecordID=" +recordid, "RadWindow2" );  
 
oWnd.center();  
 
oWnd.add_close(OnClientClose);  
 
}  
 
 
function OnClientClose(oWnd)  
 
{  
 
var order = document.getElementById("order");  
 
order.innerHTML = "<strong> Cancellation request went through.</strong>";  
 
}  
 
 
 

 

<a href="#" onclick="cancelPost('<%# DataBinder.Eval(Container.DataItem, "RecordID") %>'); return false;">Cancel</a>

 

 

Radwindow relevant Code

<script type="text/javascript">  
 
function GetRadWindow()  
 
{  
 
var oWindow = null;  
 
if (window.radWindow) oWindow = window.radWindow;  
 
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;  
 
return oWindow;  
 
}  
 
 
function CloseWindow()  
 
{  
 
var Ownd = GetRadWindow();  
 
//var oArg = new Object();  
 
//Ownd.argument = oArg;  
 
Ownd.close();  
 
}  
 
</script>  
 
                     <a href="#" onclick="cancelPost('<%# DataBinder.Eval(Container.DataItem, "RecordID") %>'); return false;">Cancel</a>    
 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 24 Nov 2008, 09:45 AM
Hi Mac,

I am afraid I could not completely understand what you are trying to achieve. However, as far as I can see from your code you are executing a client-side function, close the RadWindow and return false which prevents the postback and the server handler is not executed. If you want to execute the server handler later in your code, based on some reaction of the user, you should simply call the __doPostBack function when needed and provide the client ID of the button as first argument. Please, note that this is not directly related to the RadWindow control but to general ASP.NET knowledge. You can find more information about the __doPostBack function here

Regards,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
mac
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or