在其他aspx文件中包含aspx文件 [英] include aspx file in other aspx file

查看:117
本文介绍了在其他aspx文件中包含aspx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<% if (Session["desig"].ToString() == "Developer"){%>
    <td>
        <select name='zone' id="zone" onchange="showLoc(this.value,'mlodg_loc')"> 
            <option value="Select Zone">Select Zone</option>
            <option value="East">East</option>
            <option value="West">West</option>
            <option value="North">North</option>
            <option value="South1">South1</option>
            <option value="South2">South2</option>
            <option value="South3">South3</option>
        </select>
    </td>  
<%}
  else 
  {%>
        <td>
          <select name='zone' id="Select1" onchange="showLoc(this.value,'mlodg_loc')"> 
              <option value="Select Zone">Select Zone</option>
              <option value="<%#Session["zone"]%>"><%# Session["zone"].ToString() %></option>
          </select>
        </td>
<%}%>

如果我直接编写,上面的代码可以正常工作,我试图用其他代码编写文件和主文件中,我做了 Response.WriteFile( zone.aspx)

the code above is working fine if I am writing it directly, I tried to write this code in other file and in main file i did Response.WriteFile("zone.aspx")

我如何包含它有没有什么方法可以包含,并且还想知道一种更好的方法来编写以上语句。

How can i include it is there any way to include and also would like to know a better way to write the above statements.

谢谢

推荐答案

UserControls $code>为此在asp.net中存在,为此创建一个 .ascx 文件您拥有的一段代码,并将其用作任何地方的控件。

UserControls are there in asp.net for this purpose, make a .ascx file for this piece of code u have, and use it as a control anywhere.

这篇关于在其他aspx文件中包含aspx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆