troubleshooting Question

Error when trying to change panel control visibility using radiobuttonlist control.

Avatar of r3v0lut1on
r3v0lut1on asked on
Visual Basic.NET
6 Comments1 Solution206 ViewsLast Modified:
I am receiving this error: 'object doesn't support this property or method.' when I am attempt to change a panel control's visibilty using a radiobuttonlist control. I do NOT receive the error when I remove the button control (submit) from the page. Can anyone assist me in resolving this issue? Thanks in advance.

<%@ Page Language="VB" %>
<%@ import Namespace="system.web.mail" %>

<script runat="server">
Sub radBtnLst_Changed(sender As Object, e As EventArgs)
  If radBtnLst.selecteditem.value = "show" Then
   pnl.visible = true
  pnl.visible = false
 End If
End Sub

Sub submit_Click(sender As Object, e As EventArgs)
 Dim objMailMessage As system.web.mail.MailMessage = New MailMessage
 If isValid Then
  objMailMessage.To = ""
  objMailMessage.From = ""
  objMailMessage.Subject = "Panel Test"
  objMailMessage.Body = "name: " & txtbx1.text & vbCRLF & _
  "dept: " & txtbx2.text & vbCRLf & _
  "panel: " & testtxt.text
  objMailMessage.BodyFormat = MailFormat.text
 End If
End Sub

 <title>Panel Test</title>
 <meta http-equiv="Expires" content="0" />
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<form runat="server">
name: <asp:textbox id="txtbx1" runat="server" /><br />
dept: <asp:textbox id="txtbx2" runat="server" /><br /><br />
<asp:radiobuttonlist id="radBtnLst" onselectedindexchanged="radBtnLst_Changed" autopostback="True" runat="server">
  <asp:listitem value="show" text="show" />
  <asp:listitem value="hide" text="hide" />
</asp:radiobuttonlist><br />
<asp:panel id="pnl" runat="server" visible="false">
<asp:label runat="server" id="testtxt" />Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor <br />
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</asp:label>
</asp:panel><br />
<asp:button id="submit" onclick="submit_Click" runat="server" text="Submit Form" />

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros