[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
?
43 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

656 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