Custom control's partial rendering inside updatePanel does'nt work

Last post 05-15-2007 1:50 AM by eea61. 1 replies.

Sort Posts:

  • Custom control's partial rendering inside updatePanel does'nt work

    05-13-2007, 2:28 AM
    • Member
      135 point Member
    • eea61
    • Member since 06-15-2006, 12:59 PM
    • Posts 41

    Hi

    I have a custom control that contains a DropDownList and a Button control and a "Datasource"  and a "URL" property.

    What this control do is to get the Datasouce (of DataSet type) and bind it to DropDownList and add an attribute to the button to open a popup window with the given URL.

    In my web from I used this control inside an UpodatePanel .The problem is when I change the "URL" dinamically in my program,the previous value still remains in the button's attribute and still opens the same popup window.I added the attribute to button in OnPreRender method.Without an updatepanel it works fine.Here is some parts of code:

    public DataSet DataSource

    {

    set

    {

    EnsureChildControls();

    if (this.SelectedValue.Equals(String.Empty))

    this.SelectedValue = null;

    if (value != null)

    {

    drpOptions.Items.Clear();

    drpOptions.DataBind();

    drpOptions.DataSource = (

    DataSet)value;

    drpOptions.DataBind();

    else

    {

    drpOptions.Items.Clear();

    drpOptions.DataBind();

    }

    }

     

    public string TargetUrl

    {

    set

    {

    this.targetUrl = value;

    if (Page != null)

    Page.RegisterHiddenField(

    "__hiddenTargetUrl_" + this.ClientID, value);

    }

    get

    {

    if (Page.Request.Form["__hiddenTargetUrl_" + this.ClientID] != null && Page.Request.Form["__hiddenTargetUrl_" + this.ClientID] != "")

    return Page.Request.Form["__hiddenTargetUrl_" + this.ClientID];

    else

    return this.targetUrl;

    }

    }

    protected override void OnPreRender(EventArgs e)

    {

    btnPopUp.Visible = this.ButtonVisible;

    if (this.Enabled)

    {

    btnPopUp.Attributes.Remove("onClick");

    btnPopUp.Attributes.Add("onClick", "ShowDialog" + this.ClientID + "();return false;");

    }

    else

    {

    btnPopUp.Attributes.Remove(

    "onClick");

    btnPopUp.Attributes.Add(

    "onClick", "return false;");

    }

    }

  • Re: Custom control's partial rendering inside updatePanel does'nt work

    05-15-2007, 1:50 AM
    Answer
    • Member
      135 point Member
    • eea61
    • Member since 06-15-2006, 12:59 PM
    • Posts 41
    I solved the problem by passing the URL as an argument to javascript function that opens the popup window.
Page 1 of 1 (2 items)