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

Add RadXMLHttpPanel to a webpart in wss3.0

4 Answers 80 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
shikha bansal
Top achievements
Rank 1
shikha bansal asked on 29 Sep 2009, 07:12 AM

Hi,
We are developing an asp.net WebPart that is integrated in Sharepoint site.
The WebPart contains telerik:RadXmlHttpPanel which will have a toggled display on the click of a RadTreeViewNode(ajaxified).
The WebPart project consists of code behind file only.
No .aspx file is there.
The problem is how will the XMLHttpPanel's serviceRequest method be executed.
From the examples available on http://demos.telerik.com/aspnet-ajax/xmlhttppanel/examples/default/defaultcs.aspx,
I have seen that a javascipt function is added to a  RadScriptBlock in .aspx file. This function internally sends a call to 
XmlHttpPanel_ServiceRequest function and then the corresponding controls are loaded with values. Please let me know how to execute serviceRequest function of RadXMLHttpPanel in my case.

With Regards,
Shikha

 

4 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 29 Sep 2009, 11:00 AM
Hello Shikha,

I am not sure what the problem exactly is - as well as why you have opted for using a RadXmlHttpPanelin this particular scenario (e.g. what problem does the use of the panel solve for you).

Please describe in more detail
1) What problem you are trying to solve by using a RadXmlHttpPanel (rather than, say, use a simple RadAjaxPanel or an UpdatePanel)
2) What does not work as expected
3) Please post your code so that we examine it further.


Sincerely yours,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
zahi kramer
Top achievements
Rank 1
answered on 05 Feb 2010, 01:27 PM
Hi Tervel
i think what shikha try to ask (which is what i also interested)
is :
Do you hava a working example of RadXmlHttpPanel used programmatically ?
i mean inject the xmlhttp control via codebehind and accessing it via javascript?
i try to do it with no succsess.

thanks.

Zahi.
0
Pero
Telerik team
answered on 09 Feb 2010, 10:43 AM
Hello Zahi,

We do not have such an example but you can create it easily. You should create the XmlHttpPanel in the Page_Init event and attach event handler to the ServiceRequest server-side event or set the WebMethodName and WebMethodPath properties. For your convenience I have created a simple project that implements this scenario:

.aspx
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
 
        <script type="text/javascript">
            function SetValue()
            {
                var panel = $find("RadXmlHttpPanel1");
                panel.set_value("test");
            }
        </script>
 
    </telerik:RadScriptBlock>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <input value="Set Value" onclick="SetValue(); return false;" type="button" />
    <div>
    </div>
    </form>
</body>
</html>

.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class Dynamic_XmlHttpPanel : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        RadXmlHttpPanel xmlPanel = new RadXmlHttpPanel();
        xmlPanel.ID = "RadXmlHttpPanel1";
        xmlPanel.EnableClientScriptEvaluation = true;
        xmlPanel.ServiceRequest += new XmlHttpPanelEventHandler(xmlPanel_ServiceRequest);
        xmlPanel.WebMethodName = "";
        xmlPanel.WebMethodPath = "";
        form1.Controls.Add(xmlPanel);
    }
 
    protected void xmlPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)
    {
        Label lbl = new Label();
        lbl.ID = "Label1";
        lbl.Text = DateTime.Now.ToString();
        RadXmlHttpPanel panel = (RadXmlHttpPanel)sender;
        panel.Controls.Add(lbl);
    }
}



Sincerely yours,
Pero
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
zahi kramer
Top achievements
Rank 1
answered on 09 Feb 2010, 12:28 PM
Thanx very much.
the Page_Init event was the key.
thx.
Tags
Sharepoint Integration
Asked by
shikha bansal
Top achievements
Rank 1
Answers by
Tervel
Telerik team
zahi kramer
Top achievements
Rank 1
Pero
Telerik team
Share this question
or