在做一个企业站,其中招聘信息已经列表显示了,我想点击“查看该职位”,就能弹出一个小的页面,用表格的形式把该职位的详细信息显示出来,小页面不显示地址栏,工具栏,只显示页面中的内容。页面gridview代码如下:
 <asp:GridView ID="GVJobs" runat="server" AutoGenerateColumns="False" 
            Width="698px">
            <Columns>
                <asp:BoundField DataField="J_jobName" HeaderText="职位名称" />
                <asp:BoundField DataField="J_jobNumber" HeaderText="招聘人数" />
                <asp:BoundField DataField="J_jobEducation" HeaderText="学历要求" />
                <asp:BoundField DataField="J_jobTime" HeaderText="发布时间" />
             <asp:TemplateField>   
                 <ItemTemplate>
                 
                    <asp:LinkButton ID="LinkButton2" runat="server" Text="查看该职位" PostBackUrl='<%# "~/JobsView.aspx?J_jobId=" + Eval("J_jobId") %>' 
                      CausesValidation="False"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='<%# "~/Apply.aspx?J_jobId=" + Eval("J_jobId") %>' 
                      CausesValidation="False" Text="应聘该职位"></asp:LinkButton>
                      
                 </ItemTemplate>
            </asp:TemplateField>
            </Columns>
        </asp:GridView>

解决方案 »

  1.   

    加个OnClientClick="window.open(...)"
      

  2.   

    可以把<asp:LinkButton ID="LinkButton2" runat="server" Text="查看该职位" PostBackUrl='<%# "~/JobsView.aspx?J_jobId=" + Eval("J_jobId") %>' 
                          CausesValidation="False"></asp:LinkButton>
    改为。
    <a href="#" onclick="javascript:window.open('改下路径../JobsView.aspx?J_jobId="+<%#Eval("J_jobId")%>+"','','width=430,height=450,scrollbars=1,resizable=0')">查看该职位</a>
      

  3.   

    模态窗  window.showModalDialog(或则做个DIV  position="absolute";  把要显示的内容放DIV里 控制位置和显示不显示
      

  4.   

      function open() {
                loc_x = document.body.scrollLeft + event.clientX - event.offsetX + 100;
                loc_y = document.body.scrollTop + event.clientY - event.offsetY + 170;
                window.showModalDialog("Default2.aspx", self, "edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:350px;dialogHeight:350px;dialogTop:" + loc_y + "px;dialogLeft:" + loc_x + "px");
            }模态窗口。
      

  5.   

    可以先通过打开窗体:  function open() { 
                loc_x = document.body.scrollLeft + event.clientX - event.offsetX + 100; 
                loc_y = document.body.scrollTop + event.clientY - event.offsetY + 170; 
                window.showModalDialog("处理页", self, "edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:350px;dialogHeight:350px;dialogTop:" + loc_y + "px;dialogLeft:" + loc_x + "px"); 
            } 在处理页上,进行数据的绑定和处理~~
      

  6.   

    又是模态啊!
    <script>
       function open()
       {
          window.showmodaldialog('url' 参数....)
       }
    </script> onclientclik="open()"
      

  7.   

    var div1 = document.createElement("div");
    div1.innerHtml = 内容
    内容在这里可以是一个table的html也可以是文本
      

  8.   

    首先给GridView中的<ItemTemplate>加入一个隐藏的控件
    <asp:Label ID="lbl_Role" runat="server" Text='<%# Bind("J_jobName") %>' Visible="false"></asp:Label>
    并且对于LinkButton1和LinkButton2各加入属性
    CommandName="Command1"
    CommandName="Command2"然后给GridView加入事件
        protected void GVJobs_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton Search= (LinkButton)e.Row.FindControl("LinkButton1");
                
                Search.CommandArgument = e.Row.RowIndex.ToString();
            }
        } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int index = Convert.ToInt32(e.CommandArgument);
            if (e.CommandName == "Command1")
            {
                string role = ((Label)this.GridView1.Rows[index].FindControl("lbl_Role")).Text;
                string url = "RoleManage.aspx?UserID=" + userID + "&type=1";//举例
                ClientScript.RegisterStartupScript(this.GetType(), "pop", "popUp('" + url + "' ,600,450)", true);
            }
            if (e.CommandName == "Command2")
            {
                string role = ((Label)this.GridView1.Rows[index].FindControl("lbl_Role")).Text;
                string url = "RoleManage.aspx?UserID=" + userID + "&type=2";//举例
                ClientScript.RegisterStartupScript(this.GetType(), "pop", "popUp('" + url + "' ,600,450)", true);
            }
         }最后在前台页面加入楼主想要的JS
        <script type="text/javascript">
    function popUp(url,width,height,winname,left,top)
    {
    var left = (left==''||left==null)?(screen.width - width)/2:left;
    var top = (top==''||top==null)?(screen.height - height)/2:top;
    var winnames = (winname=='')?'popUpWin':winname;
    window.open(url, winnames, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    }
    </script>
      

  9.   

       protected void GVJobs_RowCreated(object sender, GridViewRowEventArgs e) 
        { 
            if (e.Row.RowType == DataControlRowType.DataRow) 
            { 
                LinkButton Search= (LinkButton)e.Row.FindControl("LinkButton1"); 
                
                Search.CommandArgument = e.Row.RowIndex.ToString(); 
                LinkButton Apply= (LinkButton)e.Row.FindControl("LinkButton2"); 
                
                Apply.CommandArgument = e.Row.RowIndex.ToString(); 
            } 
        } 
    刚才少了一句
      

  10.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {           ((HyperLink)e.Row.Cells[0].FindControl("HyperLink1")).Attributes.Add("onclick", "windows.open('')");
             
                ((HyperLink)e.Row.Cells[0].Controls[0]).Attributes.Add("onclick", "windows.open('')");
            }
        }