?
Solved

Best method to use in developing a Visual Studio web application - multiview or webforms to replicate tab control from winforms?

Posted on 2016-08-09
7
Medium Priority
?
38 Views
Last Modified: 2016-08-09
I have a data entry screen in a winform that has 12 tabs to perform entry.  I am converting this application to a webform and need the best method to recreate the 12 tabs.  

Using the multiview option, when I move to view=1 and choose something from a listbox, it takes me back to view=0.   I added the EnableViewState=False and that screen worked okay but when I went back to view-0, my listboxes weren't populating correctly, so I went back to the drawing board.  I created another webform for the "second tab."  That works fine and the labor is the same to no biggie until I need to save.  I feel a nightmare coming on.  I also want to use this form(s) for editing a record.

Any advice for the best plan of attack?
0
Comment
Question by:Karen Wilson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 2000 total points
ID: 41749108
This is an "easy" one.

I use two divs. The top div ("tabs") holds the tabs, the bottom div ("tabPages") has a div for each tab (tab1page, tab2page, etc.) . Show & hide the [tab#page] divs  based on user input. All controls are always there. You can have javascript, server-side, and viewstate on all controls.

Some controls have large amounts of viewstate data. If you put too many "heavy" controls on a single page, the viewstate data (that goes upstream) can get a bit ridiculous. If performance is good, you can usually ignore the size of the viewstate.

Good luck!
0
 

Author Comment

by:Karen Wilson
ID: 41749139
I have a menu for all the tabs so I should be able to just reference the div, right?  I Id'd the div like this:   <div id="Information">

I only want this div to appear on the startup of this data entry. How do I do that?
0
 

Author Closing Comment

by:Karen Wilson
ID: 41749177
I figured it out.  Thanks for putting me on the right path.

   <div id="div_Require" runat="server">  I had to runat the server.

On my page load I have this code:

 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None

        c = Environ("username")

        If Not IsPostBack Then
            Dim getRspOff = (From id In d.tblDepts _
                                 Group By ro = id.RespOffice Into Group _
                                 Order By ro Ascending _
                                 Select ro).ToList

            Me.PMComboBox.DataSource = getRspOff
            Me.PMComboBox.DataBind()
        End If

        div_Information.Visible = True
        div_Require.Visible = False

    End Sub

All seems to be working well so far!  Thanks again.
Karen
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Karen Wilson
ID: 41749184
I guess I spoke too soon!  When I move to the second div on the page, when I select something in a list box, it makes me back to the first div.  Do I need to open another question?
0
 
LVL 12

Expert Comment

by:funwithdotnet
ID: 41749247
Do you have an event associated with the listbox selection?

Remember that some controls persist their values but not their source data on postback. The data may need to be re-bound on every trip for viewstate to be restored.
0
 

Author Comment

by:Karen Wilson
ID: 41749264
The listbox is filled by editing the items.  When one/multiple item(s) is selected, the values are added to a textbox, where the user can then fill in more information.  The textbox is used to update the record when saved.  The listbox has the Enable Auto Postback selected.


Protected Sub ListBox14_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox14.SelectedIndexChanged
        Me.txtCustAgree.Text = CStr(ListBox14.SelectedItem.Value)
End Sub
0
 
LVL 12

Expert Comment

by:funwithdotnet
ID: 41749333
So it seems that when the listbox index changes, a postback happens, but some controls aren't recreating their previous environment.

I'm not sure about the combobox. Some data sources do not persist and will be empty after postback. You might want to populate them with every postback.

If you debug and step through your code, sniffing values as you go (hover the cursor over an object name), you can see exactly what is happening when in the lifecycle. Remember that a web application has already died when it's returned to the browser. A postback causes a new application to run. Viewstate helps re-create the state from the previous application execution. You have to do the rest yourself.

Also, document.getElementById("elementId") from the HTML DOM is one of my best friends. Javascript can do wonders with it without a postback.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

765 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