DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Web User Control

  1. #1
    Join Date
    Jul 2004

    Web User Control

    I am trying to create a simple web user control that is collapsible using DIV tag.
    However, I don't seem to be able to get it to expand or collapse, below is my code for my user control.
    Can someone help?
    Thank you very much.
    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="WebUserControl2.ascx.vb" Inherits="TestingonClickControl.WebUserControl2" TargetSchema="" %>

    <P><INPUT type="submit" name="Button1" id="Button1" value="...">&nbsp;</P>
    <div id="divImageList" class="divImgList" style="DISPLAY: none; POSITION: absolute" runat="server">
    <aspanel id="Panel1" Height="264px" Width="152px" runat="server">
    <P><asp:Image id="Image2" Height="51px" Width="136px" runat="server" ImageUrl="file:///C:\apple.bmp"></asp:Image></P>

    <script language="javascript" event="onclick" for="Button1">
    var it = document.getElementById("divImageList");

    if (it != null) {
    var dis =;
    if (dis == "block")
    dis="block"; = dis;

  2. #2
    Join Date
    May 2005
    I guess when the web user control renders on the page and the button inside the user control renders the clientside id wouldn't be Button1, it would be something like
    Usercontrolid_ButtonId something so in your javascript tag the for = "button1" is incorrect,
    the best thing would be enclose all your javascript in a function and add this as a attribute to the button in the user control on page load of the control as
    button1.attributes.add("onclick", functionname);
    If this button is not required to post back to the server use the html input button rather than the button

    Let me know if it worked
    try this and let me know

Similar Threads

  1. Replies: 1
    Last Post: 07-05-2005, 06:16 AM
  2. Re: Why REST is a better way to do Web Services
    By Michael D. Kersey in forum .NET
    Replies: 2
    Last Post: 08-30-2002, 12:05 AM
  3. Replies: 1
    Last Post: 08-27-2002, 02:28 AM
  4. Replies: 1
    Last Post: 03-30-2002, 01:14 AM
  5. advanced user control topic
    By Ian Drake in forum ASP.NET
    Replies: 0
    Last Post: 10-30-2001, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center