473,434 Members | 1,818 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,434 software developers and data experts.

Public ReadOnly Property

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_lstCategorie
Public ReadOnly Property SelectedCategoriesID As String
Get
return lstCategorie.ClientID
End Get
End Property

Public ReadOnly Property SelectedStatesID As String
Get
return lstStates.ClientID
End Get
End Property
"redirect functions

'strSelectedCategories = lstCategorie.ClientID.SelectedItem.Value
'strSelectedStates = lstStates.ClientID.SelectedItem.Value

If strSelectedStates <> "0" AND strSelectedCategories ="0" Then
strFormID = strSelectedStates
SendUserToState(strFormID)
Elseif strSelectedStates = "0" AND strSelectedCategories <> "0" Then
'response.write ("categories")
'response.end
strFormID = strSelectedCategories
SendUserToCategorie(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.redirect("browselistingsbystate.aspx?Stat eID=" & strFormID)
Case Else
'do jack all
End Select
End Function

Public Function SendUserToCategorie(ByVal strFormID as Integer)
Select Case strFormID
Case 6,10,8,7,11,13,9,12
response.redirect("browselistings.aspx?CategoryID= " & 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="lstCategorie" runat="server" Rows="1"
AutoPostBack="true"
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="true"
DataTextField="Location" DataValueField="LocationID" />

Browse :
Browse :
Nov 20 '05 #1
3 5751
How are you putting these option values in ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Moe Sizlak" <mo*@moe.com> wrote in message
news:uw**************@TK2MSFTNGP11.phx.gbl...
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_lstCategorie
Public ReadOnly Property SelectedCategoriesID As String
Get
return lstCategorie.ClientID
End Get
End Property

Public ReadOnly Property SelectedStatesID As String
Get
return lstStates.ClientID
End Get
End Property
"redirect functions

'strSelectedCategories = lstCategorie.ClientID.SelectedItem.Value
'strSelectedStates = lstStates.ClientID.SelectedItem.Value

If strSelectedStates <> "0" AND strSelectedCategories ="0" Then
strFormID = strSelectedStates
SendUserToState(strFormID)
Elseif strSelectedStates = "0" AND strSelectedCategories <> "0" Then
'response.write ("categories")
'response.end
strFormID = strSelectedCategories
SendUserToCategorie(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.redirect("browselistingsbystate.aspx?Stat eID=" & strFormID)
Case Else
'do jack all
End Select
End Function

Public Function SendUserToCategorie(ByVal strFormID as Integer)
Select Case strFormID
Case 6,10,8,7,11,13,9,12
response.redirect("browselistings.aspx?CategoryID= " & 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="lstCategorie" runat="server" Rows="1"
AutoPostBack="true"
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="true"
DataTextField="Location" DataValueField="LocationID" />

Browse :
Browse :

Nov 20 '05 #2
Heres a couple of examples. One using a dropdownlist and one using a
radiobuttonlist. It was not clear what control you were using.

HTH

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Dim dl As DropDownList = DirectCast(sender, DropDownList)
Response.Write(dl.SelectedItem.Value)

End Sub

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Dim ol As RadioButtonList = DirectCast(sender, RadioButtonList)
Response.Write(ol.SelectedItem.Value)

End Sub

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Moe Sizlak" <mo*@moe.com> wrote in message
news:uw**************@TK2MSFTNGP11.phx.gbl...
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_lstCategorie
Public ReadOnly Property SelectedCategoriesID As String
Get
return lstCategorie.ClientID
End Get
End Property

Public ReadOnly Property SelectedStatesID As String
Get
return lstStates.ClientID
End Get
End Property
"redirect functions

'strSelectedCategories = lstCategorie.ClientID.SelectedItem.Value
'strSelectedStates = lstStates.ClientID.SelectedItem.Value

If strSelectedStates <> "0" AND strSelectedCategories ="0" Then
strFormID = strSelectedStates
SendUserToState(strFormID)
Elseif strSelectedStates = "0" AND strSelectedCategories <> "0" Then
'response.write ("categories")
'response.end
strFormID = strSelectedCategories
SendUserToCategorie(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.redirect("browselistingsbystate.aspx?Stat eID=" & strFormID)
Case Else
'do jack all
End Select
End Function

Public Function SendUserToCategorie(ByVal strFormID as Integer)
Select Case strFormID
Case 6,10,8,7,11,13,9,12
response.redirect("browselistings.aspx?CategoryID= " & 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="lstCategorie" runat="server" Rows="1"
AutoPostBack="true"
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="true"
DataTextField="Location" DataValueField="LocationID" />

Browse :
Browse :

Nov 20 '05 #3
Hi There,

I am binding the values from a db into the list, the problem is I want to be
able to include both of the lists in a header on one page only, the page
loads correctly but when I make a selection from the list and reload the
page with the "autopostback=true" attribute the control's name is lost in
the process. Now using the property I have managed to get the control name
back but I can't access any of the option values form the list!!

Any ideas?

Moe
Public Sub BindStates()
Try
Dim myConnection as New
SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Const strSQL as String = "SELECT LocationID, '...' + Location + '...' AS
Location " & _
"FROM tbLocation ORDER BY Location"
Dim myCommand as New SqlCommand(strSQL, myConnection)
myConnection.Open()
Dim objDR as SqlDataReader
objDR = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
lstStates.DataSource = objDR
lstStates.DataBind()
lstStates.Items.Insert(0, new ListItem("-- Choose a State --","0"))

Catch ex as InvalidCastException
Status.Text = ex.ToString()

Catch ex As SqlException
Status.Text = "Database error: " & ex.message

Catch ex As Exception
Status.Text = "General error: " & ex.message
End Try

End Sub

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Heres a couple of examples. One using a dropdownlist and one using a
radiobuttonlist. It was not clear what control you were using.

HTH

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Dim dl As DropDownList = DirectCast(sender, DropDownList)
Response.Write(dl.SelectedItem.Value)

End Sub

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Dim ol As RadioButtonList = DirectCast(sender, RadioButtonList)
Response.Write(ol.SelectedItem.Value)

End Sub

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Moe Sizlak" <mo*@moe.com> wrote in message
news:uw**************@TK2MSFTNGP11.phx.gbl...
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_lstCategorie
Public ReadOnly Property SelectedCategoriesID As String
Get
return lstCategorie.ClientID
End Get
End Property

Public ReadOnly Property SelectedStatesID As String
Get
return lstStates.ClientID
End Get
End Property
"redirect functions

'strSelectedCategories = lstCategorie.ClientID.SelectedItem.Value
'strSelectedStates = lstStates.ClientID.SelectedItem.Value

If strSelectedStates <> "0" AND strSelectedCategories ="0" Then
strFormID = strSelectedStates
SendUserToState(strFormID)
Elseif strSelectedStates = "0" AND strSelectedCategories <> "0" Then
'response.write ("categories")
'response.end
strFormID = strSelectedCategories
SendUserToCategorie(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.redirect("browselistingsbystate.aspx?Stat eID=" & strFormID)
Case Else
'do jack all
End Select
End Function

Public Function SendUserToCategorie(ByVal strFormID as Integer)
Select Case strFormID
Case 6,10,8,7,11,13,9,12
response.redirect("browselistings.aspx?CategoryID= " & 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="lstCategorie" runat="server" Rows="1"
AutoPostBack="true"
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="true"
DataTextField="Location" DataValueField="LocationID" />

Browse :
Browse :


Nov 20 '05 #4

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

Similar topics

3
by: Straatvark | last post by:
Hi, I know the MSDN documents etc specify that readonly properties of an object is not included in the XML that is generated - but any idea why? This put some rather severe limitations on how...
4
by: Jon Maz | last post by:
Hi, Quick & easy one - why does this code give an error? ===== CODE ===== private int numberOfPages;
6
by: darrel | last post by:
I'm still not quite sure how best to handle the passing of data between controls. This is a method I'm using at the moment: I have an XML file that contains a variety of page-centric...
17
by: Tom | last post by:
I have written a property, where I want to have the GET be available to anyone (i.e. Public); however, I want the SET to be available ONLY to the class or program itself (i.e. Friend). In VB6...
9
by: Stefan De Schepper | last post by:
Should I use: Private m_Name As String Public Property Name() As String Get Return m_Name End Get Set(ByVal Value As String) m_Name = Value
2
by: Saran | last post by:
Hi, Below is my scenario... I want to restrict my clients to access one of my class property in ReadOnly mode. At the same time as an author of the component i would like to have read-write...
4
by: Smithers | last post by:
I understand there is no "right" or "wrong" answer to the question posited below. But I'd appreciate some feedback on the "best practice" considerations - if there are any. So here goes: Are...
11
by: dgk | last post by:
If I have a class with a public variable, isn't this the same as a private variable with a property? ie, isn't this: Public Class MyTest Public MyVar as String End Class the same as this: ...
5
by: Tony Johansson | last post by:
Hello! This class Card displayed below is from a book called "Visual Studio 2005". Now to my question here they haved used accessibility of public for the two field suit and rank This is...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...

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.