请教:这种绑定有错误还是缺少什么必须的步骤?

louwei666 2010-08-11 07:38:45
要通过页面传过来的shopid去一个固定文件夹下面读取静态htm(都是通过软件都已经生成好的)
<tr> <td colspan="2"><iframe name="head" width="100%" runat="server" src="./templates/shoptype/shop_page_7_2.htm" frameborder="0"></iframe></td></tr>
这种把路径中的shop_page_7_1.htm写死掉是可以显示出来再页面上的

但是<td width="200"><iframe width="200" name="leftdepart" runat="server" src="./templates/shoptype/shop_page_<% =shopid%>_2.htm" frameborder="0"></iframe></td>这种却显示不出来 shopid已经传到页面上了 是不是这种绑定方式有问题 还是缺少代码?

后台代码为:
public string shopid;
protected void Page_Load(object sender, EventArgs e)
{
shopid = this.Request.QueryString["shopid"];
response.write(shopid);这句执行shopid是有值的
}
...全文
68 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
chinawes 2010-08-11
  • 打赏
  • 举报
回复
你把shopid放在Session里面试试。
kiaoqq2010 2010-08-11
  • 打赏
  • 举报
回复
真困啊~~吧变量shopid定义为全局变量。
louwei666 2010-08-11
  • 打赏
  • 举报
回复
还是不行。。。
chinawes 2010-08-11
  • 打赏
  • 举报
回复
把shopid加上个.ToString()试试。

public string shopid;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if(this.Request.QueryString["shopid"] != null)
shopid = this.Request.QueryString["shopid"].ToString();
}

}



<td width="200"><iframe width="200" name="leftdepart" runat="server" src="./templates/shoptype/shop_page_<% =shopid%>_2.htm" frameborder="0"></iframe></td>
louwei666 2010-08-11
  • 打赏
  • 举报
回复
改成双引号报错说服务器标记不正确 单引号没报错 但还是没显示页面 头大啊
chinawes 2010-08-11
  • 打赏
  • 举报
回复
写法没有问题,按照1楼的试试,感觉是你参数的格式不对,或者用单引号

<td width="200"><iframe width="200" name="leftdepart" runat="server" src="./templates/shoptype/shop_page_'<% =shopid%>'_2.htm" frameborder="0"></iframe>
myhope88 2010-08-11
  • 打赏
  • 举报
回复
如果是html好像不能处理服务器端的代码吧
q107770540 2010-08-11
  • 打赏
  • 举报
回复
<td width="200"><iframe width="200" name="leftdepart" runat="server" src="./templates/shoptype/shop_page_<% =shopid%>_2.htm" frameborder="0"></iframe></td>
=================================
<td width="200"><iframe width="200" name="leftdepart" runat="server" src="./templates/shoptype/shop_page_"+<% =shopid%>+"_2.htm" frameborder="0"></iframe></td>

62,266

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧