By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,642 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,642 IT Pros & Developers. It's quick & easy.

Public ReadOnly Property

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.