locked
Webpart question RRS feed

  • Question

  •  

    All,

     

    I have a question as following:

     

    I use XMLHttpRequest in page to call server in web part. Such as:

     

    var url=window.location.href+"?Request=myrequest";
    xmlHttp.open('GET', url, true);
    xmlHttp.send();

     

    After execute this javascript, in the web part's overide method CreateChildControls, do the logic as following:

     

        protected override void CreateChildControls()
            {
                if (Page.Request.QueryString["Request"] != null)
                {

                      TextBox txtBox=new TextBox();

                      this. Controls.Add(txtBox);

                 }

                           base.CreateChildControls();

            }

     

    I use vistudio to attach the precess, and find that after excuteing above logic, the textbox has been added to the control, but why it can not display on the page?

    Can you help me?

     

    Thanks,

    Dillon

    Friday, February 29, 2008 4:04 AM

Answers

  •  

    I don't think you've shown enough of your code in order to give you an answer.  What happens when the request returns?

    Its asynchronous so show the function you attach to the onreadystatechange event of the xmlhttp object.

     

    You should consider getting FiddlerTool with which you can examine exactly what is being returned by your request.

     

    Also are you sure that the location.href doesn't already contain a search string.

     

     

    Thursday, March 13, 2008 10:29 AM

All replies

  • Anyone can answer this question?

     

    Friday, February 29, 2008 4:49 AM
  •  

    I don't think you've shown enough of your code in order to give you an answer.  What happens when the request returns?

    Its asynchronous so show the function you attach to the onreadystatechange event of the xmlhttp object.

     

    You should consider getting FiddlerTool with which you can examine exactly what is being returned by your request.

     

    Also are you sure that the location.href doesn't already contain a search string.

     

     

    Thursday, March 13, 2008 10:29 AM
  •  

    Thanks, Anthony Jones. I have fixxed this issue.

    Tuesday, March 18, 2008 1:53 AM