I have a web form with 2 radbutton. Approve and Reject. When Reject button is clicked. I would like to pop up radprompt to capture reject reason and update the reason via stored proc from code behind.
How can I capture the reason and using it from code behind?
How can I capture the reason and using it from code behind?
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 04 Jul 2011, 07:34 AM
Hello Cheekl,
Check out the following code library submission which explains how to call a radalert from codebehind. You can try the same approach to achieve your scenario.
Calling radalert from codebehind (all versions of RadWindow).
From the version 2011.1.315 the predefined dialogs (radalert, radconfirm and radprompt) can be called by using the new server methods RadAlert, RadConfirm and RadPrompt of the RadWindowManager.
Check out the following demo for more on this.
Window / Alert, Prompt, Confirm.
Thanks,
Shinu.
Check out the following code library submission which explains how to call a radalert from codebehind. You can try the same approach to achieve your scenario.
Calling radalert from codebehind (all versions of RadWindow).
From the version 2011.1.315 the predefined dialogs (radalert, radconfirm and radprompt) can be called by using the new server methods RadAlert, RadConfirm and RadPrompt of the RadWindowManager.
Check out the following demo for more on this.
Window / Alert, Prompt, Confirm.
Thanks,
Shinu.
0
cheekl
Top achievements
Rank 2
answered on 05 Jul 2011, 04:13 AM
Thanks for the help. I manage to call up the radprompt and trigger the callback function with the code behind
protected void btnReject_Click(object sender, EventArgs e)
{
try
{
RadAjaxManager1.ResponseScripts.Add(@"radprompt('Reject reason', promptCallBackFn, 330, 160, null, 'Reject', '')");
}
However in the promptCallBackFn, I am trying to assign the value return to a asp:label and the object is null
function promptCallBackFn(args)
{
var lbl = $find("<%=lblRejectReason.ClientID %>");
lbl.text = args;
}
I believe it is something to do with Ajax where the control is not loaded, how can I overcome this?
protected void btnReject_Click(object sender, EventArgs e)
{
try
{
RadAjaxManager1.ResponseScripts.Add(@"radprompt('Reject reason', promptCallBackFn, 330, 160, null, 'Reject', '')");
}
However in the promptCallBackFn, I am trying to assign the value return to a asp:label and the object is null
function promptCallBackFn(args)
{
var lbl = $find("<%=lblRejectReason.ClientID %>");
lbl.text = args;
}
0
Hi Cheekl,
You should use $get() to get reference to the label client-side object. The $find() method is used only for script controls/components.
http://msdn.microsoft.com/en-us/library/bb397717.aspx
http://msdn.microsoft.com/en-us/library/bb397441%28v=VS.100%29.aspx
Best wishes,
Iana
the Telerik team
You should use $get() to get reference to the label client-side object. The $find() method is used only for script controls/components.
http://msdn.microsoft.com/en-us/library/bb397717.aspx
http://msdn.microsoft.com/en-us/library/bb397441%28v=VS.100%29.aspx
Best wishes,
Iana
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
cheekl
Top achievements
Rank 2
answered on 08 Jul 2011, 03:58 AM
I still get a null value from $get
function promptCallBackFn(args)
{
var lbl = $get("lblPromptValue");
lbl.text = args;
}
lblPromptValue is a hidden label.
<asp:Label ID="lblPromptValue" runat="server" Text="" Visible="false"></asp:Label>
function promptCallBackFn(args)
{
var lbl = $get("lblPromptValue");
lbl.text = args;
}
lblPromptValue is a hidden label.
<asp:Label ID="lblPromptValue" runat="server" Text="" Visible="false"></asp:Label>
0
Hello Cheekl,
What if you change the code like this:
Best wishes,
Iana
the Telerik team
What if you change the code like this:
function
promptCallBackFn(args)
{
var
lbl = $get(
"<%= lblPromptValue.ClientID %>"
);
lbl.innerHTML = args;
}
Best wishes,
Iana
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
cheekl
Top achievements
Rank 2
answered on 13 Jul 2011, 05:10 AM
I found the problem. It is because I set lblPromptValue visible = false.