Solved

placeholder disappears on submit to Db

Posted on 2011-03-01
6
389 Views
Last Modified: 2012-06-27
I have a placeholder that is filled with labels that should remain static unless they move to another person, but when i commit a transaction to a db, ithe information in the placeholder disappears and then I have to go back and load it agian.  I put my sections inot 2 different updatepanels but it still happens, how can i keep the information in placeholder on the screen.


This get run when they pick a person. and put in a placeholder, I have it in a seperate updatepanel but when ever I commit a transaction it disappears.

 If myDataTable.Rows.Count = 0 Then
            Dim lblMessage As New Label()
            lblMessage.Text = "No Family Member"
            lblMessage.ForeColor = Drawing.Color.Firebrick
            phFamily.Controls.Add(lblMessage)
        Else
            For Each row As DataRow In myDataTable.Rows
                Dim lblMessage As New Label()
                'Create the message control
                lblMessage.Text = "  " & row(0).ToString & "<br />"
                lblMessage.ForeColor = Drawing.Color.Firebrick
                phFamily.Controls.Add(lblMessage)
            Next

Open in new window

0
Comment
Question by:kdeutsch
  • 4
  • 2
6 Comments
 
LVL 18

Expert Comment

by:ChetOS82
ID: 35007690
Placeholders don't "remember" the information that was put in them, they need to be rebound on every postback.

Now, if you placeholder is in one UpdatePanel, and your trying to update a different UpdatePanel, then you need to set the "UpdateMode" on both UpdatePanels to "Conditional".
0
 

Author Comment

by:kdeutsch
ID: 35007986
ChetOS82:
Thanks, I played with it and only set the one to conditional, if I sent them both then it does not work.  The inforimation in the second update panel is reliant on the first panel of information and without it cannot appear, and setting it to conditional kept it from appearing.
0
 

Author Comment

by:kdeutsch
ID: 35008082
Ok, this shut down other things on my page, I have 2 link buttons on a modal popup one that keeps me on the page and the other that hides and refreshes the page.  This is the point that is nto working.  It now does nothing.  Is there something I have to do.  This protion sits in the other update panel.

 Protected Sub lnkProbCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkProbCancel.Click
        Dim SrpID As Integer = ddlSrpEvent.SelectedValue
        txtFindSoldier.Text = String.Empty
        ddlSrpEvent.SelectedValue = SrpID
        pnlSRP.Visible = False

        pnlProblems_ModalPopupExtender.Hide()
    End Sub
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 18

Accepted Solution

by:
ChetOS82 earned 500 total points
ID: 35008096
If you have inter-UpdatePanel changes, then you cannot use Conditional mode.

The placeholder needs to be repopulated (rebound) every time it is loaded because it doesn't not store the state of all the controls across postbacks.
0
 

Author Comment

by:kdeutsch
ID: 35008754
ChetOS82:
Ok, see what you mean, what a pain.  Problem is the page is reliant on both.  Thanks for the help, i will rebind  the placeholder at this point.
0
 

Author Closing Comment

by:kdeutsch
ID: 35008763
thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now