Add RadXMLHttpPanel to a webpart in wss3.0

5 posts, 0 answers
  1. shikha bansal
    shikha bansal avatar
    8 posts
    Member since:
    Sep 2009

    Posted 29 Sep 2009 Link to this post

    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

     

  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 29 Sep 2009 Link to this post

    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.

  3. zahi kramer
    zahi kramer avatar
    3 posts
    Member since:
    Aug 2009

    Posted 05 Feb 2010 Link to this post

    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.
  4. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 09 Feb 2010 Link to this post

    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.
  5. zahi kramer
    zahi kramer avatar
    3 posts
    Member since:
    Aug 2009

    Posted 09 Feb 2010 Link to this post

    Thanx very much.
    the Page_Init event was the key.
    thx.
Back to Top