Hi. it is my primer tuto post.
Topic: how use RadConfirm() function in a button (or another control with similar ClientEvents) without make a full postback (just it is different to use confirm javascript function).
scenario:
Asp.net framework 4, RadControls for asp.net 2011 Q2, c# development
Steps.
1. Add this controls to you aspx file.
RadScriptManager
RadAjaxManager
RadWindowManager
RadButton
Another controls that satisfy your needs.
2. Set ajax manager to your fits, for example set radbutton as fire control and a image control as updated control
3. Set onClientClicked event of your radbutton as: 'CheckItem'
4. Set CommandName argument as 'btnShowImage' (or of you preference, this must identify unique control)
5. include next javascript code in your aspx file.
Explain: btnShowImage is a button which when pressed displays the image in an image field (or your explicit need). this button must have some postback event for this example 'onclick' event (behind code). when user clicks on the radbutton fires client side event 'CheckItem' if command name parameter match with button then function call RadConfirm method: "
Topic: how use RadConfirm() function in a button (or another control with similar ClientEvents) without make a full postback (just it is different to use confirm javascript function).
scenario:
Asp.net framework 4, RadControls for asp.net 2011 Q2, c# development
Steps.
1. Add this controls to you aspx file.
RadScriptManager
RadAjaxManager
RadWindowManager
RadButton
Another controls that satisfy your needs.
2. Set ajax manager to your fits, for example set radbutton as fire control and a image control as updated control
3. Set onClientClicked event of your radbutton as: 'CheckItem'
4. Set CommandName argument as 'btnShowImage' (or of you preference, this must identify unique control)
<
telerik:RadButton
ID
=
"btnShowImage"
runat
=
"server"
Text
=
"Show Image"
OnClick
=
"btnShowImage_Click"
CommandName
=
"btnShowImage"
onclientclicked
=
"CheckItem"
>
</
telerik:RadButton
>
5. include next javascript code in your aspx file.
function
CheckItem(sender, e) {
if
(sender._commandName ==
"btnShowImage"
) {
RadConfirm(
"¿are sure?"
, btnShowImageResume, 330, 100,
null
,
"Confirm."
);
sender.set_autoPostBack(
false
);
}
else
{
sender.set_autoPostBack(
true
);
}
}
function
btnShowImageResume(arg) {
if
(arg) {
__doPostBack(
"btnShowImage"
,
"onclick"
);
}
}
Explain: btnShowImage is a button which when pressed displays the image in an image field (or your explicit need). this button must have some postback event for this example 'onclick' event (behind code). when user clicks on the radbutton fires client side event 'CheckItem' if command name parameter match with button then function call RadConfirm method: "
RadConfirm(confirm message
, javascript function that be executed after user take a decision, width, height,
objet reference
,
message tittle
);"
After, javascript cancel objet postback (preventing that compiler continues with onclick event code.) else continues with postback.
When user takes a decision RadConfirm call resume function in this example:'btnShowImageResume' function, this function validate if arg parameter (result) is true then executes onclick event of the control else does not do nothing (you can execute another event if you want). when we call to _dopostback javascript function, RadAjaxManager evalues situation and execute its.
I hope they will be of great help.