473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to fix something on a web page

I'm wanting to fix the following on a web page without really re-inventing
anything.

What I have is a vb web page with a radiobuttonlist where I can pick Current
or History year.

Underneath that is a listbox that has a set of reports in it, some for
current year, some for history year. If Current year is chosen, 6 reports
(depending on user access level) are listed, on the History one, 2 are
listed (also depending on user access level). The menus are developed as a
part of the page_load event (see below).

What happens is that the list gets built when the page opens, and items are
listed and removed, based on their access level. The selectedindex property
is set to -1 when the page is initally displayed (the radio button and the
listbox are set to autopostback).

The problem is, if I click on the History radio button, and then 1 of the
reports, it does nothing, other than post back to the page. At that time,
the selected index is still -1 (when I click on the report on the history
tab the first time). When I click on it a second time, it sets it to the
appropriate value and runs the report.

There is code in the selectedindexchanged event that checks to see if the
index is set to -1, it exited the sub, and on the autopostback, I'd click it
a second time to run the report.

I'm not sure what to do with this piece of code, to just display a menu of
reports to run.

I would appreciate any input as to a "good" way (this one seems bassackwards
to me) to make a list of reports to programatically display to sets of
users, passing on appropriate session variables.

Any help appreciated.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Session("Connectstring") = Application("Connectstring")
rbtnSales.Visible = False
If Request.QueryString("User") = "" Then
lblUser.Text = Session("UserName")
End If
If Session("Sales") = "" Then
Session("Permission") = Request.QueryString("P")
Session("Pass") = Request.QueryString("Pass")
Session("UserName") = Request.QueryString("Name")
Session("ActUser") = Request.QueryString("Act")
Session("User") = Request.QueryString("User")
Session("Sales") = Request.QueryString("Sales")
Session("Calendar") = Request.QueryString("Calendar")
Session("Sales") = Session("Sales").replace("-", "/")
Session("Sales") = Session("Sales").replace(".", ":")
Session("Calendar") = Session("Calendar").replace("-", "/")
Session("Calendar") = Session("Calendar").replace(".", ":")
Session("ViewProdHierSKUStatus") =
Request.QueryString("SKUStat")
Session("ViewOldSys") = Request.QueryString("Oldsys")
End If

If Session("UserName") = "" Then
Server.Transfer("../Default.aspx")
End If
Session("ActUser") = UCase(Session("ActUser"))

btnNewJreports.Visible = True
If rbtnRpts.SelectedItem.Value <> Type Then
ListBox2.Visible = False
If rbtnRpts.SelectedItem.Value = "CY" Then
ListBox1.Items.Clear()
ListBox1.Items.Add("Purchase Order Status")
ListBox1.SelectedIndex = 0
ListBox1.SelectedItem.Value = "CYPOS"
ListBox1.Items.Add("Product Hierarchy (Business Area)")
ListBox1.SelectedIndex = 1
ListBox1.SelectedItem.Value = "CYPH"
ListBox1.Items.Add("Sales Summary")
ListBox1.SelectedIndex = 2
ListBox1.SelectedItem.Value = "CYSS"
ListBox1.Items.Add("Accessories Stock-on-Hand Report")
ListBox1.SelectedIndex = 3
ListBox1.SelectedItem.Value = "ACCSOH"
ListBox1.Items.Add("Customer Listing (J1)")
ListBox1.SelectedIndex = 4
ListBox1.SelectedItem.Value = "CLIST"
ListBox1.Items.Add("Product Listing")
ListBox1.SelectedIndex = 5
ListBox1.SelectedItem.Value = "PLIST"
'ListBox1.Rows = 11
If Session("User") = "user2" Or Session("User") = "user1" Or
Session("User") = "user3" Or Session("User") = "user4" Or Session("User") =
"user5" Or Session("User") = "user6" Then
ListBox1.Items.Add("Distribution Channel (Product
Hierarchy) ")
ListBox1.SelectedIndex = 6
ListBox1.SelectedItem.Value = "CYPHDC"
ListBox1.Items.Add("Distribution Channel (Customer) ")
ListBox1.SelectedIndex = 7
ListBox1.SelectedItem.Value = "CYCUSDC"
'''ListBox1.Items.Add("Summary Reports")
'''ListBox1.SelectedIndex = 8
'''ListBox1.SelectedItem.Value = "Reports"
ListBox1.Items.Add("Remlink Usage Statistics")
ListBox1.SelectedIndex = 8
ListBox1.SelectedItem.Value = "RUS"
ListBox1.Rows = 9
If Session("ViewProdHierSKUStatus") = "YES" Then
ListBox1.Items.Add("Product Hierarchy SKU Status
(Business Area)")
ListBox1.SelectedIndex = 9
ListBox1.SelectedItem.Value = "PHPO"
ListBox1.Rows = 10
End If
Else
'''' comment out these lines & change indexes to release
without J1 code.
'''ListBox1.Items.Add("Summary Reports")
'''ListBox1.SelectedIndex = 6
'''ListBox1.SelectedItem.Value = "Reports"
'''ListBox1.Rows = 7
'code for new report
If Session("ViewProdHierSKUStatus") = "YES" Then
ListBox1.Items.Add("Product Hierarchy SKU Status
(Business Area)")
ListBox1.SelectedIndex = 6
ListBox1.SelectedItem.Value = "PHPO"
ListBox1.Rows = 7
End If
End If
ListBox1.SelectedIndex = -1
Else
If Session("User") = "user2" Or Session("User") = "user1" Or
Session("User") = "user3" Or Session("User") = "user4" Or Session("User") =
"user5" Or Session("User") = "user6" Or Session("User") = "HYLERKS" Then
ListBox1.Items.Clear()
ListBox1.Items.Add("Product Hierarchy")
ListBox1.SelectedIndex = 0
ListBox1.SelectedItem.Value = "HYPH"
ListBox1.Items.Add("Customer Rank")
ListBox1.SelectedIndex = 1
ListBox1.SelectedItem.Value = "CYCR"
ListBox1.Items.Add("Item Rank")
ListBox1.SelectedIndex = 2
ListBox1.SelectedItem.Value = "HYIR"
'ListBox1.Items.Add("Quarterly")
'ListBox1.SelectedIndex = 3
'ListBox1.SelectedItem.Value = "HQPH"
ListBox1.Rows = 3
'ListBox1.Height = Unit.Pixel(55)
ListBox1.SelectedIndex = -1
Else
ListBox1.Items.Clear()
'ListBox1.Items.Add("Product Hierarchy")
'ListBox1.SelectedIndex = 0
'ListBox1.SelectedItem.Value = "HYPH"
ListBox1.Items.Add("Customer Rank")
ListBox1.SelectedIndex = 0
ListBox1.SelectedItem.Value = "CYCR"
ListBox1.Items.Add("Item Rank")
ListBox1.SelectedIndex = 1
ListBox1.SelectedItem.Value = "HYIR"
'ListBox1.Items.Add("Quarterly")
'ListBox1.SelectedIndex = 3
'ListBox1.SelectedItem.Value = "HQPH"
ListBox1.Rows = 2
ListBox1.SelectedIndex = -1
End If
End If
Type = rbtnRpts.SelectedItem.Value
End If
If Session("User") = "customer1" Or Session("User") = "customer2" Or
Session("User") = "customer3" Or Session("user") = "customer4" Or
Session("User") = "customer5" Then
BtnJReports.Visible = False
Hyperlink1.Visible = False
Hyperlink2.Visible = False
If rbtnRpts.SelectedItem.Value = "CY" Then
'If ListBox1.Items.Count = 5 Then
If ListBox1.Items.Count = 4 Then ' changed 4/2/03
items.count = 4
ListBox1.Items.RemoveAt(2)
ListBox1.Items.RemoveAt(2)
End If
If ListBox1.Items.Count = 5 Then ' changed 4/2/03
items.count = 5
ListBox1.Items.RemoveAt(4)
ListBox1.Items.RemoveAt(2)
End If
If ListBox1.Items.Count = 6 Then ' changed 4/2/03
items.count = 5
ListBox1.Items.RemoveAt(5)
ListBox1.Items.RemoveAt(4)
ListBox1.Items.RemoveAt(2)
End If
' if we have the product list showing, remove it for
customers
If ListBox1.Items.Count = 7 Then ' changed 4/2/03
items.count = 5
ListBox1.Items.RemoveAt(6)
ListBox1.Items.RemoveAt(5)
ListBox1.Items.RemoveAt(4)
ListBox1.Items.RemoveAt(2)
End If
ListBox1.Rows = 3
End If
If rbtnRpts.SelectedItem.Value = "Hist" Then
If ListBox1.Items.Count = 3 Then
ListBox1.Items.RemoveAt(0)
End If
ListBox1.Rows = 2
End If
End If

ListBox1.Rows = ListBox1.Items.Count

lblUser.Text = Session("UserName") & " Date/Time: " & DateTime.Now
'rbtnSales.Text = "Sales Year Data (" & Session("Sales") & ")
<-For Reference Only"
rbtnCalendar.Text = "Calendar Year Data (" &
Session("Calendar") & ")"
End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim sType As String
' If rbtnSales.Checked = True Then
' sType = "Sales"
' Else
sType = "Calendar"
' End If
Dim xxxx As Integer
xxxx = ListBox1.SelectedIndex
Dim yyyy As String
yyyy = ListBox1.SelectedItem.Value
'If ListBox1.SelectedIndex = -1 Then Exit Sub
Session("Report") = ListBox1.SelectedItem.Value
TransactionLog("")
Select Case ListBox1.SelectedItem.Value
Case "CYPH" 'Current Year Product Hierarchy
Server.Transfer("../sales/J5group.aspx?YR=" & sType & "&DC="
& Request("cboChannel") & "&T=" & Request("txtTerritory") & "&R=" &
Request("cboRegion") & "&BA=" & Request("BA") & "&C=Rounds" & "&UID=" &
Session("User") & "&Special=")
Case "Reports" 'Current Year Product Hierarchy
ListBox2.Visible = True
Case "CYPHC" 'Current Year Product Hierarchy Customer
Server.Transfer("../sales/customerp.aspx?DC=" &
Session("EndUse") & "&User=" & Session("User") & "&C=" & "&Yr=" & sType &
"&Special=")
Case "CYPHCI" 'Current Year Product Hierarchy Item
Server.Transfer("../sales/Item.aspx?SKU=" & "&Special=")
Case "CYPHDC" 'Current year Product Hierarchy Dist Chnl
Server.Transfer("../sales/J5group.aspx?DC=---" & "&Rpt=J4" &
"&Yr=" & sType) '& Request.QueryString("UID") & "&C=" & "&Yr=" & sType &
"&Special=")
'Server.Transfer("../sales/customerp.aspx?DC=" &
CStr(cmbChannel.SelectedItem.Value).Replace("'", "''") & "&User=" &
Request.QueryString("UID") & "&C=" & "&Yr=" & sType & "&Special=" )
'Server.Transfer("../sales/testing.aspx?User=" &
Request.QueryString("UID") & "&C=" & "&Yr=" & sType & "&Special=" )
Case "CYSS" 'Current Year Sales Summary
Server.Transfer("../sales/j4Group.aspx?DC=" &
Request("cboChannel") & "&Yr=" & sType & "&UID=" & Session("user") &
"&Special=")
' uncomment to test system page for migrating the changes
'
Server.Transfer("../sales/Holdpage-j4groupdotaspx.aspx?DC=" &
Request("cboChannel") & "&Yr=" & sType & "&UID=" & Session("user") &
"&Special=")
Case "CYCR" ' Current Year Customer Rank
Server.Transfer("../sales/pctofsales.aspx?YR=" & sType &
"&UID=" & Session("User") & "&Special=")
Case "HYPH" 'History Product Hierarchy
Server.Transfer("../sales/J7ProductHierarchy.aspx?YR=" &
sType & "&DC=" & Request("cboChannel") & "&T=" & Request("txtTerritory") &
"&R=" & Request("cboRegion") & "&BA=" & Request("BA") & "&C=Rounds" &
"&UID=" & Session("User") & "&Special=")
Case "HYPHC" 'History Product Hierarchy Customer
Server.Transfer("../sales/J7ProductHierarchy.aspx?YR=" &
sType & "&DC=" & Request("cboChannel") & "&T=" & Request("txtTerritory") &
"&Cust=" & "&R=" & Request("cboRegion") & "&BA=" & Request("BA") &
"&C=Rounds" & "&UID=" & Session("User") & "&Special=") '&
Session("user"))
Case "HYPHI" 'History Product Hierarchy Item
Server.Transfer("../sales/ItemHistory.aspx?SKU=" & "&YR=" &
sType & "&Special=")
Case "HYPHDC" 'History Product Hierarchy Dist Chnl

Case "HQPH" 'History Product Hierarchy
Server.Transfer("../sales/qtrly.aspx?YR=" & sType & "&DC=" &
Request("cboChannel") & "&T=" & Request("txtTerritory") & "&Cust=" & "&R=" &
Request("cboRegion") & "&BA=" & Request("BA") & "&C=Rounds" & "&UID=" &
Session("User") & "&Special=") '& Session("user"))
Case "HQPHC" 'History Product Hierarchy Customer
Server.Transfer("../sales/qtrly.aspx?YR=" & sType & "&DC=" &
Request("cboChannel") & "&T=" & Request("txtTerritory") & "&Cust=" & "&R=" &
Request("cboRegion") & "&BA=" & Request("BA") & "&C=Rounds" & "&UID=" &
Session("User") & "&Special=") '& Session("user"))
Case "HYQI" 'History Product Hierarchy Item
Server.Transfer("../sales/ItemQtrly.aspx?SKU=" & "&YR=" &
sType & "&Special=")
Case "HQPHDC" 'History Product Hierarchy Dist Chnl
Case "CYPOS" 'Current year Product Hierarchy Purchase Order
Status
Server.Transfer("../sales/POInquiry.aspx?DC=" & "&User=" &
Request.QueryString("UID") & "&C=" & "&Yr=" & sType & "&Special=")
Case "HYIR"
Server.Transfer("../sales/ItemRank.aspx?YR=" & sType &
"&UID=" & Session("User") & "&Special=")
Case "CYCUSDC"
Server.Transfer("../sales/POInquiryDC.aspx?DC=---" &
"&User=" & Request.QueryString("UID") & "&C=" & "&Yr=" & sType &
"&Special=")
Case "RUS"
Server.Transfer("../UserLogIns.aspx")
Case "OLD"
Server.Transfer("../sales/oldsystem.aspx?YR=" & sType)
Case "ACCSOH"
Server.Transfer("../sales/accsoh.aspx")
Case "CLIST"
Server.Transfer("../sales/customerlist.aspx?YR=" & sType)
Case "PLIST"
Server.Transfer("../sales/productlist.aspx")
Case "PHPO"
Server.Transfer("../sales/PHPOSum.aspx")
End Select

End Sub
Nov 18 '05 #1
0 1231

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Infiniti | last post by:
Lets say I have an xml file as such <page> <chapter> <paragraph/> <paragraph/> <paragraph/> <paragraph/> <paragraph/> </chapter>
5
by: uberderf | last post by:
I have the following web page setup: http://angels.uberderf.com/glossary.html I have a 2 column table layout which is a glossary of terms and their meanings. When you view this page in firefox...
6
by: Tom Szabo | last post by:
Hi, I am wondering if it is possible to send/ submit something to a server and not to update the page. Considering a large page, when the user clicks on an item, I like to send a message to the...
7
by: Gapingwound | last post by:
I have one page that is not validating XHTML1 STRICT properly, but the validator at w3c is showing an error for something that is not in my page. Here's the error: 1. Line 72, column 160:...
8
by: windandwaves | last post by:
Hi Folk I want to create something like AMAZON: those who liked page A also liked page B (I am going to apply the concept to a few different selections, but to keep it simple I will talk about...
5
by: vimakefile | last post by:
I'd like to have the concept of a Page (different code-behind file for each url, session state, etc.) but be able to specify my own custom HTTP payload. (I don't want to use any Asp.Net forms,...
9
by: Johnfli | last post by:
I currently have my website on a NT4 box, all pages work fine. I am working on moving it over to a win200k web edition server. I have my connection to my SQL working, copied all the pages to the...
25
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
1
by: WT | last post by:
Hello, I have a dictionary made with objects which contain a control element, the control element is added to a Page when I want to edit the dictionary content. I put this dictionary in cache...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.