Avatar of r3v0lut1on
r3v0lut1on
 asked on

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

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
  Else
  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 = "john.fierro@valleybaptist.net"
  objMailMessage.From = "webmaster@valleybaptist.net"
  objMailMessage.Subject = "Panel Test"
  objMailMessage.Body = "name: " & txtbx1.text & vbCRLF & _
  "dept: " & txtbx2.text & vbCRLf & _
  "panel: " & testtxt.text
 
  objMailMessage.BodyFormat = MailFormat.text
 
  SmtpMail.Send(objMailMessage)
  Response.Redirect("confirm.htm")
 End If
End Sub
</script>

<html>
<head>
 <title>Panel Test</title>
 <meta http-equiv="Expires" content="0" />
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
</head>
<body>
<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" />
</form>
</body>
</html>
Visual Basic.NET

Avatar of undefined
Last Comment
PAQ_Man

8/22/2022 - Mon
kisru

Check if the objMailMessage is declared properly

i.e
Dim objMailMessage As system.web.mail.MailMessage = New MailMessage()
r3v0lut1on

ASKER
kisru,

That was not the issue. I am still receiving the same error and my panel does not become visible. Thanks for the help anyways! I appreciate it.

John
r3v0lut1on

ASKER
I have increased the Point Value to 250. Even though I am unable to resolve this issue, I really didn't think it was going to be that difficult for the Experts here on the Exchange. I guess it is an unusual request or my question is just buried in with all the other questions. Any assistance on this issue is greatly appreciated. Thanks in advance!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
kisru

r3v0lut1on

ASKER
kisru,

Thanks again. I looked at the page but did not find any help. This is an ASP 3.0 (.NET) issue.

--------------

I HAVE RESOLVED the issue by renaming the button control's id. I am not sure why this resolved the issue but my show/hide sub routine now works properly.
ASKER CERTIFIED SOLUTION
PAQ_Man

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question