473,394 Members | 2,071 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,394 software developers and data experts.

MENU Control ~

want to know if you could please help me out in resolving an issue I am
having regarding my Menu control.

The ASP.NET Menu control requires extra work in order to access the database
data, if you want to populate your Menu control with database data.

I have added my control to my MasterPage and written some code to display
the data from the dataset table. However, I cannot figure out how I am
going to extract the LANGUAGE used by the default.aspx page and use it in my
sql parameter @languageID.


At the moment I have hard coded the languageID value into my string Select
statement as "1"

My code:

' Get the data from the database and create the top-level menu items

Sub PopulateMenu()

Dim dst As DataSet = GetMenuData()

For Each masterRow As DataRow In dst.Tables("org").Rows()

Dim masterItem As New MenuItem(masterRow("otherName").ToString())

CrownCorpMenu.Items.Add(masterItem)

Next

End Sub

' Use a DataAdapter and DataTSet to grab the database data

Private Function GetMenuData() As DataSet

' Retrieve the data from the org table

Dim selectCommand As String = "SELECT * FROM org WHERE (languageID = 1)"

Dim dad As SqlDataAdapter = New SqlDataAdapter(selectCommand, conTBS)

Dim dstOrg As DataSet = New DataSet()

dad.Fill(dstOrg, "org")

Return dstOrg

End Function

I do realize that I must use something like the following:

Dim cmd As New SqlCommand("Select * From org WHERE (languageID =
@languageID)"

cmd.Parameters.AddWithValue("@languageID", languageID)

I tried using request.form("langID") / request.QueryString("langID") to
extract the value langID from the default.aspx page but I keeping getting a
returned value of NULL.
Any help would be greatly appreciated,

Thanks in advance,

~Brad

--
------------------------------
Brad Isaacs
Developer, Consultant
www.webdevcreations.com
bi*****@rogers.com
Feb 5 '07 #1
1 2363
Dear Group,

I have resolved my issue. I finally figured out that it really helps when
you use
Request.QueryString
against the CORRECT
value..........................................^#% #$%^$#!!

lol......

If Not Page.IsPostBack Then

If Request.QueryString("lang") = "" Then

languageID = "1"

Else

languageID = "2"

End If

Then down in my SQL Query I used >>>>

Retrieve the data from the org table

Dim selectCommand As String = "SELECT * FROM org WHERE languageID = " &
languageID

And that solved my issue........
Thanks,

~Brad
"Brad Isaacs" <bi*****@rogers.comwrote in message
news:ut**************@TK2MSFTNGP03.phx.gbl...
want to know if you could please help me out in resolving an issue I am
having regarding my Menu control.

The ASP.NET Menu control requires extra work in order to access the
database data, if you want to populate your Menu control with database
data.

I have added my control to my MasterPage and written some code to display
the data from the dataset table. However, I cannot figure out how I am
going to extract the LANGUAGE used by the default.aspx page and use it in
my sql parameter @languageID.


At the moment I have hard coded the languageID value into my string Select
statement as "1"

My code:

' Get the data from the database and create the top-level menu items

Sub PopulateMenu()

Dim dst As DataSet = GetMenuData()

For Each masterRow As DataRow In dst.Tables("org").Rows()

Dim masterItem As New MenuItem(masterRow("otherName").ToString())

CrownCorpMenu.Items.Add(masterItem)

Next

End Sub

' Use a DataAdapter and DataTSet to grab the database data

Private Function GetMenuData() As DataSet

' Retrieve the data from the org table

Dim selectCommand As String = "SELECT * FROM org WHERE (languageID = 1)"

Dim dad As SqlDataAdapter = New SqlDataAdapter(selectCommand, conTBS)

Dim dstOrg As DataSet = New DataSet()

dad.Fill(dstOrg, "org")

Return dstOrg

End Function

I do realize that I must use something like the following:

Dim cmd As New SqlCommand("Select * From org WHERE (languageID =
@languageID)"

cmd.Parameters.AddWithValue("@languageID", languageID)

I tried using request.form("langID") / request.QueryString("langID") to
extract the value langID from the default.aspx page but I keeping getting
a returned value of NULL.
Any help would be greatly appreciated,

Thanks in advance,

~Brad

--
------------------------------
Brad Isaacs
Developer, Consultant
www.webdevcreations.com
bi*****@rogers.com


Feb 5 '07 #2

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

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
5
by: dpomt | last post by:
When the ASP.NET menu is rendered on downlevel browers, the text "^ up one level" is displayed. Any ideas how I can change that text? I did not find a property for the menu control where I can...
17
by: GS | last post by:
the main menu in the application seemed to disappeared all together until I click on an control and select mainmenu1 in designer. then the mainmenu1 displays where it should be but running it or...
3
by: John | last post by:
Hi there, I was reading an article (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf) on 'all-menu navigation' and I'd like to try and implement this in my site. Can...
5
by: Brad Isaacs | last post by:
Good morning friends, I am working with ASP.NET 2.0 -- VB code behind I have created tabbed pages using the Menu control with the Multiview control. Using the menu control to display the...
2
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
5
by: AG | last post by:
I realize that the obvious suggestion would be malware, but my definitions are up to date and I have already scanned for it. I have also tried disabling all IE add-ons. I just rebuilt and...
4
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.