如题

解决方案 »

  1.   

    给div 标签加上runat=server可以让C#来操作如:
    <div id="myDiv" runat="server" > </div>
    if (条件)
    {
      myDiv.Attributes["style"]="display:none"; //隐藏
    }
    else
    {
      myDiv.Attributes["style"]="display:block"; //显示
    }
      

  2.   

    用panel控件就可以了 panel发到客户端就是div标签 你可以用panel的enable属性控制
      

  3.   


    <div id="InfoDiv" style="z-index: 100; left: 518px; width: 225px; position: absolute;
              top: 1240px; height: 100px">
          </div>
    InfoDiv后面我怎么点,都点不出什么东西来
      

  4.   

    给div 标签加上runat=server可以让C#来操作如: 
    <div id="myDiv" runat="server" > </div> myDiv.Visible = true;//or false
      

  5.   

    没有+上 runat="server" 你不回发给服务器,在.CS里面怎么能得到其ID呢,
    <div id="InfoDiv" style="z-index: 100; left: 518px; width: 225px; position: absolute;
              top: 1240px; height: 100px" runat="server">
          </div>
    .cs里面
    InfoDiv.Visible = false;
    InfoDiv.Visible = true;
      

  6.   

    哦,原来我少了个runat="server"那如果在另外一个文件cs里面,要操作 InfoDiv, 该怎么办
      

  7.   

    Index.aspx文件<%@ Register Src="Control/ProductGridView.ascx" TagName="ProductGridView" TagPrefix="uc1" %>
    怎么在Control/ProductGridView.ascx文件里面操作Index.aspx里面的div呢
      

  8.   

    怎么在 Control/ProductGridView.ascx.cs 文件里面操作Index.aspx里面的div呢
      

  9.   


    <script language="javascript" type="text/javascript">
    function topMenu()
    {  
      var obj=document.getElementById("topNews");
      var objwidth=document.getElementById("abc");
     
      if(document.all.topImg.value == '1')
      {
        document.all.topImg.value = '0';
        document.all.topImg.src = "images/r.gif";
        obj.style.display="none";
        objwidth.style.width="98%";
       
      }
      // display the menu
      else
      {
        document.all.topImg.value = '1';
        document.all.topImg.src = "images/l.gif";
        obj.style.display="";
        objwidth.style.width="79%";
      } 
    }
    </script>html代码<div id="basic-accordian" style="height:100%" >
    <div  id="topNews" style="width: 19%; float: left; cursor: pointer;font-weight: bold;">
     <div>
    <label id="Label2"></label>
    <div id="test1-header1" >
        <asp:TreeView ID="TreeView1" runat="server" Font-Size="12px">
                                        <ParentNodeStyle Font-Bold="True" ForeColor="#000099" />
                                        <HoverNodeStyle BackColor="#D9E7F8" />
                                        <SelectedNodeStyle BackColor="#D9E7F8" />
                                        <RootNodeStyle Font-Bold="True" ForeColor="#000099" />
                                    </asp:TreeView>
    </div>
    </div>
    </div>
    <div  style="width:12px; height: 450px; float:left; background-color:#99bbe8; " >
            <table  border="0" cellpadding="0" cellspacing="0"  height="100%"  width="12px";>
                <tr>
                    <td valign="middle" align="left"  style="text-align:center;">
                        <img  id="topImg"  src="images/l.gif" 
                                    value='1' style="CURSOR: hand; width: 12px;" onclick="topMenu();"></td>
                </tr>
            </table>
     </div>
           <div id="abc" style="float:left; width: 79%;HEIGHT:420px;padding-top:0px ">
    <div id="test1-content">
    <iframe name="ifim" src="ktdtzbsr.aspx" WIDTH=100%  HEIGHT=450px ></iframe>
    </div>
    </div>
    </div>点击图片的时候隐藏左边的div
      

  10.   

    完整的html代码<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ktdtzb.aspx.cs" Inherits="ktdtzb" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
    <head  id="Head1" runat="server" >
    <link href="butt.css" type="text/css" rel="stylesheet" />
    <meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
    <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript">
    function topMenu()
    {  
      var obj=document.getElementById("topNews");
      var objwidth=document.getElementById("abc");
     
      if(document.all.topImg.value == '1')
      {
        document.all.topImg.value = '0';
        document.all.topImg.src = "images/r.gif";
        obj.style.display="none";
        objwidth.style.width="98%";
       
      }
      // display the menu
      else
      {
        document.all.topImg.value = '1';
        document.all.topImg.src = "images/l.gif";
        obj.style.display="";
        objwidth.style.width="79%";
      } 
    }
    </script>
    <title></title>
    <style type="text/css">
        * {
    margin: 0;
    padding: 0;
    list-style: none;
    }
    body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    background:white
    }
    #basic-accordian {
    border: 5px solid  #99BBE8;
    padding:0px;
    width: 99%;
    height:100%;
    z-index: 2;
    }
    .accordion_headings {
    padding:3px;
    cursor: pointer;
    font-weight: bold;
    background: #E4E0D5;
    }
    .accordion_headings:hover {
    background: #D9E7F8;
    }
    .accordion_child {
    padding: 5px;
        color:#15428B;
    height:400px;
    background: #D9E7F8;


    }
    .header_highlight {
         background: #D9E7F8;

    }.indiv {
    padding: 5px;
        color:#15428B;
    background: #D9E7F8;
    border: 1px solid #99BBE8;

    }
     a { text-decoration: none; color: #15428B} 
    a:active{ background-color:#D9E7F8;text-decoration: none; color:#15428B}/*已访问的*/
      
    </style>
    <script type="text/javascript" src="./js/accordian.pack.js"></script>
    </head>
    <body id="body" bgcolor="#F1efe2"><form id="form1" runat="server"><div id="basic-accordian" style="height:100%" >
    <div  id="topNews" style="width: 19%; float: left; cursor: pointer;font-weight: bold;">
     <div>
    <label id="Label2"></label>
    <div id="test1-header1" >
        <asp:TreeView ID="TreeView1" runat="server" Font-Size="12px">
                                        <ParentNodeStyle Font-Bold="True" ForeColor="#000099" />
                                        <HoverNodeStyle BackColor="#D9E7F8" />
                                        <SelectedNodeStyle BackColor="#D9E7F8" />
                                        <RootNodeStyle Font-Bold="True" ForeColor="#000099" />
                                    </asp:TreeView>
    </div>
    </div>
    </div>
    <div  style="width:12px; height: 450px; float:left; background-color:#99bbe8; " >
            <table  border="0" cellpadding="0" cellspacing="0"  height="100%"  width="12px";>
                <tr>
                    <td valign="middle" align="left"  style="text-align:center;">
                        <img  id="topImg"  src="images/l.gif" 
                                    value='1' style="CURSOR: hand; width: 12px;" onclick="topMenu();"></td>
                </tr>
            </table>
     </div>
           <div id="abc" style="float:left; width: 79%;HEIGHT:420px;padding-top:0px ">
    <div id="test1-content">
    <iframe name="ifim" src="ktdtzbsr.aspx" WIDTH=100%  HEIGHT=450px ></iframe>
    </div>
    </div>
    </div>
    </form>
    </body>
    </html>
      

  11.   

    新建一个ktdtzb.aspx,把代码复制过去就可以用