Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > accessing the readonly properties of a listmenu with a user control?

Reply
Thread Tools

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

 
 
Moe Sizlak
Guest
Posts: n/a
 
      07-15-2004
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" />


 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      07-15-2004
Hi,

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

Public ReadOnly Property SelectedCategoriesID As String
Get
return lstCategorie.SelectedItem.Value
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!
 
Reply With Quote
 
 
 
 
Moe Sizlak
Guest
Posts: n/a
 
      07-17-2004
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 SelectedCategoriesID As String
Get
return lstCategorie.SelectedItem.Value
End Get
End Property
Public ReadOnly Property SelectedStatesID As String
Get
return lstStates.SelectedItem.Value
End Get
End Property


"Natty Gur" <> wrote in message
news:...
> Hi,
>
> If I get you right you need to use ListBox SelectedItem.Value to get
> current user select value.
>
> Public ReadOnly Property SelectedCategoriesID As String
> Get
> return lstCategorie.SelectedItem.Value
> 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!



 
Reply With Quote
 
Natty Gur
Guest
Posts: n/a
 
      07-17-2004
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!
 
Reply With Quote
 
Moe Sizlak
Guest
Posts: n/a
 
      07-17-2004
Hi Natty,

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

Sean
"Natty Gur" <> wrote in message
news:uC$...
> 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!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple user control with a single ReadOnly Property. "NOT A MEMBER OF" ?? jobs ASP .Net 0 08-15-2007 07:02 PM
Designer Support: How to have user control's properties appear in IDE's properties window? Max2006 ASP .Net 2 07-13-2007 01:45 PM
ReadOnly Properties - Arguements For/Against Rob Meade ASP .Net 5 12-05-2005 03:53 PM
Accessing Datagrid properties within a user control from the outside Craig G ASP .Net 3 11-30-2004 02:51 PM
ASP.NET Readonly panel function with readonly checkbox, readonly radiobutton Jonathan Hyatt ASP .Net Web Controls 1 06-08-2004 07:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57