locked
how to use Updatepanel control on custom web page in crm2011? RRS feed

  • Question

  • WebForm1.aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" EnableViewState="true"
        Inherits="WebApplication1.WebForm1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <base target="_self" />
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
            <div>
                <asp:DropDownList ID="DropDownList1" runat="server" Width="150px" AutoPostBack="true"
                    OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                </asp:DropDownList>
            </div>
            <div>
              
            <asp:UpdatePanel ID="update" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                 <asp:TextBox ID="txtShow" runat="server"></asp:TextBox></div>
                </ContentTemplate>
                <Triggers>
             <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
                </Triggers>
            </asp:UpdatePanel>
            <div>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"
                    Style="height: 21px" /></div>
        </div>
        </form>
    </body>
    </html>

    WebForm1.aspx.cs

            private static string globeParameter = string.Empty;
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    globeParameter = "start";
                    List<ListItem> item = new List<ListItem>()
                    {
                         new ListItem() { Text = "one", Value = "1", Selected=true},
                         new ListItem() { Text = "two", Value = "2" },
                         new ListItem() { Text = "three", Value = "3" }
                    };
                    DropDownList1.Items.AddRange(item.ToArray());
                }
            }

            protected void btnSubmit_Click(object sender, EventArgs e)
            {
                txtShow.Text = "Hello-" + globeParameter;
            }

            protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                txtShow.Text = DropDownList1.SelectedValue; ;
            }

    It works OK running in visual studio 2011, the textbox which in the updatepanel will change when select different dropdownlist items,

    but the textbox cannot refresh when I generate and publish it in the ISV folder in the CRM.

    I almost search all the forum for this problem, but nobody get a solution.

    somebody said that need to configurate the web.config in my application, but I don't know how to configurate it.

    Hope someone could help me, thanks in advance.

    Monday, August 12, 2013 9:04 AM

All replies

  • If you can host the asp page on a server somewhere, you can use an IFrame to display it.  Just go to Insert> Iframe.  Same place you go to insert a tab, section, or web resource. 

    Hope that helps!

    Ray

    Tuesday, August 13, 2013 2:44 PM
  • Thanks for your reply.

    Ray, I not use it on the form in CRM 2011, I add a button on the Order form by using the ribborn tool, then it will direct to my web form(WebForm1.aspx) when click it. 

    The following code is the action of the button:

    function OnButtonClick(){

        var orgName = Xrm.Page.context.getOrgUniqueName();
        var id=Xrm.Page.data.entity.getId()
        var openUrl = "/" + orgName + "/ISV/SubmitResponse/WebForm1.aspx";
        window.open(openUrl, 'SelectPerson', 'location=no');

    }

    Monday, August 19, 2013 8:41 AM
  • ASPX pages are no longer supported in the ISV folder with CRM 2011. There may be some possible ways in which you could get it to work but the answer is really to host your custom ASPX pages somewhere else, not within CRM.
    Monday, August 19, 2013 7:35 PM
  • It could be you're affected by the CRM web.config settings - see http://mscrmuk.blogspot.de/2010/10/webconfig-settings-eg-viewstate-session.html . However, you are enabling viewState at the page level, which should resolve that issue.

    What happens when you select an item in the drop-down list ? Does the SelectedIndexChanged event fire, or not ?


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Tuesday, August 20, 2013 8:26 AM
    Moderator
  • Thanks David, I just test if UpdatePanel control is supported in CRM.  the  txtShow will be show the value that you selected from dropdownlist control.

    The selectedIndexChanged event can be triggered after I deploy my web application under the ISV directory in CRM.  but only execute once,

    then it doesn't work when I select another item again.

    I have tried to modify the value of enableViewState both on the web page and Web.config.

    but it didn't work.

    The error on the page:

    Detail information: analysis“
    <html>
    <head>
    <t” error。




     

    Wednesday, August 21, 2013 9:44 AM
  • I agree with the comments that have been made in this thread. CRM 2011 no longer supports the deployment of web applications into the ISV folder in CRM. This is because the root web.config for CRM conflicts with the web.config for your custom application, and you will have to do some tricky configuration changes to prevent your application from asking for "CRM-related" assemblies. This involves using the <remove.../> tag in your web.config file.

    Also, if your application talks to CRM via the SDK, you will receive errors where the application will crash as it cannot recognise the <remove> tag.

    Please deploy your custom application into a separate website in IIS. Once this is done, test the application by navigating directly to the page in the browser. Once you are happy it works there, proceed with referencing the webpage from an iFrame inside CRM.

    Thursday, August 22, 2013 8:05 AM