locked
Problem with .NET 3.5 Extension web site while WCF service call RRS feed

  • Question


  • Hi,
    I am trying to creat a .NET 3.5 Extension web site that would call a WCF web service. I have an update panel, that works fine with if i am not calling WCF service. but when i call the WCF service this update panel does not work anymore. Here is my code:

    IClassManagementService proxy = new ClassManagementServiceClient();
        protected void Page_Load(object sender, EventArgs e)
        {
                
            try
            {
                PopulateLeftTree();
            }
            catch (CommunicationException commProblem)
            {
                Response.Write("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
            }
            Label1.Text = DateTime.Now.ToString();
        }

    //this is the function that calls the WCF service to populate the tree
        private void PopulateLeftTree()
        {
            string[] node = proxy.GetRootNodes();
            for (int i = 0; i < node.Length; i++)
            {
                LeftTreeView.Nodes.Add(new TreeNode(nodeIdea));
                string[] secondlevel_nodes = proxy.GetSecondLevelNodes(i);
                for (int j = 0; j < node.Length; j++)
                {
                    LeftTreeView.NodesIdea.ChildNodes.Add(new TreeNode(nodeIdea));
                }
            }
            LeftTreeView.CollapseAll();
        }

     protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }

    //and here is the html code

        <form id="form1" runat="server">
           
            <aspTongue TiedcriptManager ID="ScriptManager1" runat="server" />
            <div id="leftcontent">
                 <asp:TreeView ID="LeftTreeView" runat="server"
                EnableViewState="False" Font-Names="Verdana" Font-Size="X-Small"
                ShowLines="True">
                            <SelectedNodeStyle ForeColor="Black" />
                        </asp:TreeView>
               
            </div>
             
             
              <div id="rightcontent">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <contenttemplate>
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                  
                 </contenttemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                 <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
             </div>        
        </form>

    Here the TreeView is outside the update panel since update panel do not support TreeView. The Trigger is set for the Button1 control. It updates the current time perfectly in the Label1 in the Update Panel if the service is not called. But when ever i am calling this service, it does not work. WOuld be great if anybody can help.

    Cheers,

    Ranju
    Thursday, February 14, 2008 1:35 PM

All replies

  •  Ranju_Akram wrote:

    Hi,
    I am trying to creat a .NET 3.5 Extension web site that would call a WCF web service. I have an update panel, that works fine with if i am not calling WCF service. but when i call the WCF service this update panel does not work anymore. Here is my code:

    IClassManagementService proxy = new ClassManagementServiceClient();
        protected void Page_Load(object sender, EventArgs e)
        {
                
            try
            {
                PopulateLeftTree();
            }
            catch (CommunicationException commProblem)
            {
                Response.Write("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
            }
            Label1.Text = DateTime.Now.ToString();
        }

    //this is the function that calls the WCF service to populate the tree
        private void PopulateLeftTree()
        {
            string[] node = proxy.GetRootNodes();
            for (int i = 0; i < node.Length; i++)
            {
                LeftTreeView.Nodes.Add(new TreeNode(node));
                string[] secondlevel_nodes = proxy.GetSecondLevelNodes(i);
                for (int j = 0; j < node.Length; j++)
                {
                    LeftTreeView.Nodes.ChildNodes.Add(new TreeNode(node));
                }
            }
            LeftTreeView.CollapseAll();
        }

     protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }

    //and here is the html code

        <form id="form1" runat="server">
           
            <aspcriptManager ID="ScriptManager1" runat="server" />
            <div id="leftcontent">
                 <asp:TreeView ID="LeftTreeView" runat="server"
                EnableViewState="False" Font-Names="Verdana" Font-Size="X-Small"
                ShowLines="True">
                            <SelectedNodeStyle ForeColor="Black" />
                        </asp:TreeView>
               
            </div>
             
             
              <div id="rightcontent">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <contenttemplate>
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                  
                 </contenttemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                 <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
             </div>        
        </form>

    Here the TreeView is outside the update panel since update panel do not support TreeView. The Trigger is set for the Button1 control. It updates the current time perfectly in the Label1 in the Update Panel if the service is not called. But when ever i am calling this service, it does not work. WOuld be great if anybody can help.

    Cheers,

    Ranju
    Saturday, February 16, 2008 11:19 AM
  •  

    Saturday, February 16, 2008 11:20 AM
  •  Ranju_Akram wrote:

    Hi,
    I am trying to creat a .NET 3.5 Extension web site that would call a WCF web service. I have an update panel, that works fine with if i am not calling WCF service. but when i call the WCF service this update panel does not work anymore. Here is my code:

    IClassManagementService proxy = new ClassManagementServiceClient();
        protected void Page_Load(object sender, EventArgs e)
        {
                
            try
            {
                PopulateLeftTree();
            }
            catch (CommunicationException commProblem)
            {
                Response.Write("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
            }
            Label1.Text = DateTime.Now.ToString();
        }

    //this is the function that calls the WCF service to populate the tree
        private void PopulateLeftTree()
        {
            string[] node = proxy.GetRootNodes();
            for (int i = 0; i < node.Length; i++)
            {
                LeftTreeView.Nodes.Add(new TreeNode(node));
                string[] secondlevel_nodes = proxy.GetSecondLevelNodes(i);
                for (int j = 0; j < node.Length; j++)
                {
                    LeftTreeView.Nodes.ChildNodes.Add(new TreeNode(node));
                }
            }
            LeftTreeView.CollapseAll();
        }

     protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }

    //and here is the html code

        <form id="form1" runat="server">
           
            <aspcriptManager ID="ScriptManager1" runat="server" />
            <div id="leftcontent">
                 <asp:TreeView ID="LeftTreeView" runat="server"
                EnableViewState="False" Font-Names="Verdana" Font-Size="X-Small"
                ShowLines="True">
                            <SelectedNodeStyle ForeColor="Black" />
                        </asp:TreeView>
               
            </div>
             
             
              <div id="rightcontent">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <contenttemplate>
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                  
                 </contenttemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                 <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
             </div>        
        </form>

    Here the TreeView is outside the update panel since update panel do not support TreeView. The Trigger is set for the Button1 control. It updates the current time perfectly in the Label1 in the Update Panel if the service is not called. But when ever i am calling this service, it does not work. WOuld be great if anybody can help.

    Cheers,

    Ranju
    Saturday, February 16, 2008 11:23 AM
  • Same problem i am suffering from..

    I am adding web reference to website, but when i call service like

    wcfservice.service _service= new wcfservice.service();
    string str = _service.getname();


    throwing exception.."Operation Timed out"
    please guide me...
    Tuesday, July 7, 2009 11:15 AM
  • I am having a similar problem...

    In my scenario I subscribe to a WCF service and from time to time the service sends me a callback. The Page behaves as expected receiving and handling the call. However before the callback is finished I set some labels values which are not updated on the page...

    I am posting a simplified version of the code. Even this small bit is not working.


    .aspx extract
    <asp:UpdatePanel runat="server" ID="updPnl" UpdateMode="Conditional">
            <ContentTemplate>
                <div id="box">
                    <p>
                        Ratio :
                        <asp:Label runat="server" ID="lbRatio"></asp:Label></p>
                    <p>
                        Trades:
                        <asp:Label runat="server" ID="lbTrades"></asp:Label></p>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>


    Callback function
    public void InfoUpdated(RemoteModules.infoBaseData iData)
    {
            lbRatio.Text = iData.Ratio.ToString();
            lbTrades.Text = iData.Trades.ToString();
    }

    What I thought was going to be the hardest part is working like a charm which is the whole WCF bit. Has anyone got an idea why my labels do not update?

    (PS: it is not the first time I have a label inside an updatePanel that does not update after a postback/callback or any trip from server to page)

    Thanks
    Tuesday, October 6, 2009 2:17 AM
  • I am having a similar problem...

    In my scenario I subscribe to a WCF service and from time to time the service sends me a callback. The Page behaves as expected receiving and handling the call. However before the callback is finished I set some labels values which are not updated on the page...

    I am posting a simplified version of the codec. Even this small bit is not working.


    .aspx extract
    <asp:UpdatePanl runat="server" ID="updPnl" UpdateMode="Conditional">
        <ContentTemplate>
          <div id="box">
            <p>
              Ratio :
              <asp:Label runat="server" ID="lbRatio"<SPA style="COLOR: blue">></< span>asp:Label></< span>p>
            <p>
              Trades:
              <asp:Label runat="server" ID="lbTrades"></< span>asp:Label></< span>p>
          </< span>div>
        </< span>ContentTemplate>
      </< span>asp:UpdatePanel>
    


    Callback function
    public void InfoUpdated(RemoteModules.infoBaseData iData)
    {
        lbRatio.Text = iData.Ratio.ToString();
        lbTrades.Text = iData.Trades.ToString();
    }
    

    What I thought was going to be the hardest part is working like a charm which is the whole WCF bit. Has anyone got an idea why my labels do not update?

    (PS: it is not the first time I have a label inside an updatePanel that does not update after a postback/callback or any trip from server to page)

    Thanks

    Could you explain it more clearly? I have the similar question, The way does not work here.
    Saturday, August 28, 2010 2:31 AM