开发者

UpdatePanel not updating on imagebutton click event

开发者 https://www.devze.com 2023-02-25 23:48 出处:网络
I am creating a web page with SEVERAL updatepanels nested in ONE parent updatepanel. I have defined all of the triggers that are needed to let certain controls update controls that are in other update

I am creating a web page with SEVERAL updatepanels nested in ONE parent updatepanel. I have defined all of the triggers that are needed to let certain controls update controls that are in other updatepanels,I have set every updatepanel's updatemode to conditional and the property childrenastriggers to false, and almost everything is working accordingly. But I am stumbling on one imagebutton_Click event: when I click the imagebutton, it calls the event, but does not update a single updatepanel, though I have several other imagebuttons in the same updatepanel that update their updatepanels just fine.

Now this could just be the task of the imagebutton that is causing the problem:

  • The imagebutton starts a timer
  • The imagebutton adds a predefined table with data in another updatepanel.
  • The imagebutton activated a timer object

Possible already tried solutions: - I have tried to set the causesvalidation to false (property of the imagebutton) - I have tried to use myscriptmanager.registerASyncPostBack(imagebutton)

The code behind my button(though its not really something out of the ordinary) :

protected void imbformulier_Click(Object sender, ImageClickEventArgs e)
{
        imbFormulier.Visible = false;
        imbGebruikers.Visible = false;
        imbModellen.Visible = false;
        pnlGegevens1.Visible = false;
        pnlGegevens2.Visible = true;
        pnlNavigatie.Visible = true;
        pnlEvaluatie.Visible = true;


        //kijken welk formulier moet ingevuld worden adhv de ddl's en dit meegeven aan de zelfgemaakte klasse

        List<EvaluatieFormulier> mijnformulieren = (List<EvaluatieFormulier>)Session["mijnformulieren"];
        IEnumerator<EvaluatieFormulier> enumerator = mijnformulieren.GetEnumerator();
        EvaluatieFormulier meetegeven = new EvaluatieFormulier();
        while (enumerator.MoveNext())
        {
            if (((enumerator.Current.GebruikergeevalueerdID == ddlGebruikers.SelectedValue) && (enumerator开发者_Python百科.Current.ModelID == Convert.ToInt32(ddlModellen.SelectedValue))))
            {
                meetegeven = enumerator.Current;
                //Eventueel tekst veranderen als er al was gewerkt aan een bepaalde evaluatie
                if (meetegeven.Tijdaangewerkt == 0)
                {
                    lblInfo.Text = "Evaluatie gestart van " + ddlGebruikers.SelectedItem.Text;
                    lblDatum.Text = "Evaluatie begonnen op: "+  DateTime.Now.Date.ToString("d/M/yyyy") + "(Vandaag)" ;
                    //updaten in database
                    Session["aantalminutenaangewerkt"] = 0;
                    Session["aantalsecondenaangewerkt"] = 0;
                    timTijdAanGewerkt.Enabled = true;
                    lblTijd.Visible = true;
                }
                else
                {
                    lblInfo.Text = "Evaluatie verdergezet van " + ddlGebruikers.SelectedItem.Text;
                    lblDatum.Text = "Evaluatie laatst gewijzigd : " + meetegeven.Tijdingevuld.ToString();
                    Session["aantalminutenaangewerkt"] = meetegeven.Tijdaangewerkt;
                    Session["aantalsecondenaangewerkt"] = 0;
                    timTijdAanGewerkt.Enabled = true;
                    lblTijd.Visible = true;
                }
            }
        }


        Evaluatieform formulier = new Evaluatieform(meetegeven);
        pnlEvaluatie.ContentTemplateContainer.Controls.Add(formulier.EvaluatiePanel);
        Session["formulier"] = formulier;

        if (formulier.evaluatiemodel.Domeins.Count > 4)
        {
            imbVorige.Visible = false;
            imbvolgende.Visible = true;
        }
        else
        {
            imbVorige.Visible = false;
            imbVorige.Visible = false;
            imbvalideren.Visible = true;
        }
    }


I got this to work, after looking at every aspect, It seems that I just needed to have all of the seperate updatepanel on one page in one big parent updatepanel(which I thought it was in when I posted this "--, change updatemode to conditional and define my triggers.

0

精彩评论

暂无评论...
验证码 换一张
取 消