1
votes

I have a Tab control in one ASPX page which has 5 tabs. I am loading 5 ascx pages on this control. I have 4 ascx child controls inside the 2nd main ascx control. That is something like wizard on the 2nd main ascx page. When I load that 2nd TAB I will make it visible for 1st child ascx control. Based on the selection of any values on that control I am making visible true for the 2nd ascx child control and visible false for the 1st ascx child control. Thats not working. I am not able to see anything in the page. Its loading empty with out any controls.

What could be the issue?

Parent ascx - custom event from child ascx

         Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            ReviewEnterReportDetailsId.Visible = True
            EnterReportDetailId.Visible = True
            EnterReportViewDetail1.Visible = True
        End Sub

         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            ReviewEnterReportDetailsId.Visible = True
            EnterReportDetailId.Visible = False
            EnterReportViewDetail1.Visible = False
        End Sub

         Protected Sub ReviewEnterReportDetailsId_ERDScreenEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles ReviewEnterReportDetailsId.ERDScreenEvent
            ReviewEnterReportDetailsId.Visible = False
            EnterReportDetailId.Visible = True
            EnterReportViewDetail1.Visible = False
        End Sub

Child ascx -

Just raising an event to change the next control

1
Added some updates to my answer - should get you going.Darren Wainwright

1 Answers

0
votes

Without seeing actual code it's a little hard to say, however, when you use Visible=False nothing about that control will actually be rendered by .Net, hence seeing nothing in the source code view.

Ideally you should put these controls into a <div> and show/hide the <div> based on your conditions.

UPDATE

Also, looking at your (recently added) code, you start off in the Init by showing all 3 and then in the load you hide the last 2. Seems a little pointless as load is fired right after your init

Also - if you do not wrap your load and init code in If (Not IsPostback) then it will be fired everytime the page reloads. Wrap your code in If (Not IsPostback) and it will prevent the load from overriding what you set in ReviewEnterReportDetailsId_ERDScreenEvent