Link to home
Start Free TrialLog in
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>
Avatar of kisru
kisru

Check if the objMailMessage is declared properly

i.e
Dim objMailMessage As system.web.mail.MailMessage = New MailMessage()
Avatar of 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
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!
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
Avatar of PAQ_Man
PAQ_Man
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial