• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

How do I persist visibility of a panel control across postbacks?

My tools:  Visual Web Developer, SQL Server 2005, VB.net back coding

I have a formview control that defaults to 'edit' mode when the form starts.... on formview1 there is button1 that makes panel1 become visible. On panel1 there is radiobuttonlist1 that has 2 options; NULL and A....radiobuttonlist1 is bound to an SQL table datafield that initially has no value (NULL).....so, the default selection for the radiobuttonlist is NULL. The radiobuttonlist1 has 'autopostback' = True.

So, after the button click, panel1 becomes visible with NULL already pre-selected....if the user selects A then the postback occurs making textbox1 visible where they are to enter some data.

Here is the code in RadioButtonList1 selectedindexchanged:

    Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

            FormView1.FindControl("Panel1").Visible = True

    End Sub
   
HERE IS MY PROBLEM:
If I select option A from radiobuttonlist1, no problem.... option A gets selected and the textbox becomes visible.... BUT, if I change my mind and try to re-select the NULL option , the entire panel disappears. Why does it do this? According to the sub, any index change of the radiobuttonlist should persist visibility of panel1.

No matter how this radiobuttonlist is set up and no matter what the default value is that populates it from the SQL table, if I make an attempt to return to the radiobuttonlist default value (cause a second postback) the panel disappears despite the code that tells it to be visible.....

Any help is appreciated....thanks.

0
jazjef
Asked:
jazjef
  • 4
1 Solution
 
renjurdevanCommented:
The reason because the panel becomes null is, it may available only in edit mode!!

Ie Your panel is placed in editItemtemplate tag right?

Regards
Renju
0
 
jazjefAuthor Commented:
The formview is always in edit mode and never exits, so it's not an edit mode problem..... its a visiblity-due-to-postback issue.
0
 
jazjefAuthor Commented:
I have solved my problem by developing a workaround via a design change. The problem no longer exists.
0
 
jazjefAuthor Commented:
Dear sysadmin:

Once again, here is my previous post for my own solution to my own problem as listed above:

"I have solved my problem by developing a workaround via a design change. The problem no longer exists."

THIS QUESTION IS NO LONGER OPEN. PLEASE DO NOT NAG ME ABOUT IT. PLEASE READ THE FORUM POSTINGS BEFORE NAGGING THE MEMBERS ABOUT CLEANING UP THEIR QUESTIONS. I AM REQUESTING A REFUND OF POINTS ON THIS... THANK YOU.
0
 
jazjefAuthor Commented:
Dear sysadmin....AGAIN.... REQUESTING REFUND ON THIS QUESTION....... AGAIN.

Once again, here is my previous post for my own solution to my own problem as listed above:

"I have solved my problem by developing a workaround via a design change. The problem no longer exists."

THIS QUESTION IS NO LONGER OPEN. PLEASE DO NOT NAG ME ABOUT IT. PLEASE READ THE FORUM POSTINGS BEFORE NAGGING THE MEMBERS ABOUT CLEANING UP THEIR QUESTIONS. I AM REQUESTING A REFUND OF POINTS ON THIS... THANK YOU.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now