473,662 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing the readonly properties of a listmenu with a user control?

Hi There,

I am trying to use the to obtain the information from 2 listmenus, if the
user makes a selection the page is submitted and then based on the value
selected is transfererd to another page. This works ok on it's own but I
can't seem to access the actual value of the control or the option value
( <option value="6">...NT ...</option>)
..
Any ideas ppl?

Moe

!--- function returns these values to screen

_ctl1_lstStates
_ctl1_lstCatego rie
Public ReadOnly Property SelectedCategor iesID As String
Get
return lstCategorie.Cl ientID
End Get
End Property

Public ReadOnly Property SelectedStatesI D As String
Get
return lstStates.Clien tID
End Get
End Property
"redirect functions

'strSelectedCat egories = lstCategorie.Cl ientID.Selected Item.Value
'strSelectedSta tes = lstStates.Clien tID.SelectedIte m.Value

If strSelectedStat es <> "0" AND strSelectedCate gories ="0" Then
strFormID = strSelectedStat es
SendUserToState (strFormID)
Elseif strSelectedStat es = "0" AND strSelectedCate gories <> "0" Then
'response.write ("categories ")
'response.end
strFormID = strSelectedCate gories
SendUserToCateg orie(strFormID)
End If

End If
End Sub

Public Function SendUserToState (ByVal strFormID as Integer)
Select Case strFormID
Case 1,2,3,4,5,6,7,8 ,9
response.redire ct("browselisti ngsbystate.aspx ?StateID=" & strFormID)
Case Else
'do jack all
End Select
End Function

Public Function SendUserToCateg orie(ByVal strFormID as Integer)
Select Case strFormID
Case 6,10,8,7,11,13, 9,12
response.redire ct("browselisti ngs.aspx?Catego ryID=" & strFormID)
Case Else
'do jack all
End Select
End Function

<td height="20" width="11%">
<div align="right">< font face="Verdana, Arial, Helvetica, sans-serif"
size="1" color="#FFFFFF" >Browse
:</font></div>
</td>
<td height="20" width="14%">

<div align="left">
<asp:listbox id="lstCategori e" runat="server" Rows="1"
AutoPostBack="t rue"
DataTextField=" CategoryDesc" DataValueField= "CategoryID " />

</div>

</td>
<td height="20" width="11%">
<div align="right">< font face="Verdana, Arial, Helvetica, sans-serif"
size="1" color="#FFFFFF" >Browse
:</font></div>
</td>
<td height="20" width="14%">

<div align="left">
<asp:listbox id="lstStates" runat="server" Rows="1"
AutoPostBack="t rue"
DataTextField=" Location" DataValueField= "LocationID " />
Nov 18 '05 #1
4 1389
Hi,

If I get you right you need to use ListBox SelectedItem.Va lue to get
current user select value.

Public ReadOnly Property SelectedCategor iesID As String
Get
return lstCategorie.Se lectedItem.Valu e
End Get
End Property

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Hi Natty,

The only problem is I get the error "Object reference not set to an instance
of an object. " if I change the code to:

How can I get around this error?

Moe

Public ReadOnly Property SelectedCategor iesID As String
Get
return lstCategorie.Se lectedItem.Valu e
End Get
End Property
Public ReadOnly Property SelectedStatesI D As String
Get
return lstStates.Selec tedItem.Value
End Get
End Property
"Natty Gur" <na***@dao2com. com> wrote in message
news:eJ******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

If I get you right you need to use ListBox SelectedItem.Va lue to get
current user select value.

Public ReadOnly Property SelectedCategor iesID As String
Get
return lstCategorie.Se lectedItem.Valu e
End Get
End Property

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3
Hi,

so the user didn't select any item. select if SelectedItem is null
before using it.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Hi Natty,

The user did select an item, as soon as the form is submitted the error
occurs.

Sean
"Natty Gur" <na***@dao2com. com> wrote in message
news:uC******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

so the user didn't select any item. select if SelectedItem is null
before using it.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5

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

Similar topics

2
1552
by: Dave Wurtz | last post by:
All, Does anyone know how I can make the PropertyGrid control readonly? I want to display the PUBLIC properties of an object, but I don't want the user to be able to change them (they do need to be read/write internally, however). Along with this, if the property is a collection, the collection window should not allow the user to change values, including pressing the Add or Remove buttons. Anyway to do this?
3
1638
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to set the add/edit/delete options visble/invisible on the datagrid depending on the users's role, but found that i cannot access the grid to do this. is the only way of setting it in the page load of the usercontrol itself?
6
2244
by: arvee | last post by:
Is there a way to access controls (and their properties) in a user control? The Web Form Designer marks controls as 'Protected' which makes them inaccessable from the host form. If I mark them as Public, I can access them, but the next time the controls are manipulated in the design mode, they are converted back to Protected. Is there an obvious/easy way around this? Thanks.
0
5560
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the administrators of the jobs can always receive the latest control). The property grid is used to...
6
4065
by: evandelagrammaticas | last post by:
Hi all. I have spent the better part of a day scouring the newsgroups and I am sure that I must have come across the solution a number of times - but I am still a real newbie at asp.net so please forgive me beforehand if I ask anything really simple or ridiculous. I am going to simplify my query... the structure of my example is ---> page1.aspx ------> page1.aspx.vb --->control1.ascx for the sake of simplicity this is what I am trying...
1
2427
by: emilio1984 | last post by:
well hello, I've a question. I have 2 listmenu's. Listmenu 1 has option child and adult. Listmenu 2 has options black, and rose. Now here is the trick,,,
1
6012
by: Ryan Liu | last post by:
Hi, I know Form has a KeyPreview property, is there a similar property that can be used to control mouse event that is only processed at the from level, not the controls on it? I am asking this is because there is no ReadOnly property for RadioButton. And is ther better to even have KeyPreview, MousePreview properties for Control that can be used if the mouse keyboard event can be passed to child
0
1854
by: swep | last post by:
I have a Gridview control that has 5 columns. When a user selects "Edit", I'd like to make 3 of the columns set to "Readonly". However, when I set the 3 column's boundfield properties to "ReadOnly=True", the update does not work. Is there a way to set the readonly property to "true" for some of the columns' textbox properties and not the others? -swep
8
6556
by: RSH | last post by:
Hi, I have a situation where I have a Parent Object (Company) which has several public properties. The Company Object also creates an Employees object which has its ow set of functions and properties. I am trying to figure out how to access the Parent properties from the child object. Simplified example: Class Company Public ReadOnly Property Employees() As Employees
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.