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
29 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
  • 4
  • 3
7 Comments
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
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.

 

Author Comment

by:Karen Wilson
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

7 Experts available now in Live!

Get 1:1 Help Now