Literal绑定数据
2024-09-21 17:02:04
前台:
<asp:Literal ID = "ChiCunShow" runat = "server"></asp:Literal>
后台:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataEntity;
using System.Data;
using BRules; public partial class Manager_CYzhushou_new : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MsgShow.Text= TradeBin();//行业主键ID=876。餐饮服务,电商服务,电子商品附ID为876
ChiCunShow.Text = ChiCun();//尺寸主键ID=880。具体尺寸(例:100*100)附ID为876
}
} public string TradeVal = System.Configuration.ConfigurationManager.AppSettings["TradeVal"].ToString();
public string ChiCunVal = System.Configuration.ConfigurationManager.AppSettings["ChiCunVal"].ToString();
/// <summary>
/// 绑定行业
/// </summary>
/// <param name="parentid"></param>
/// <returns></returns>
public string TradeBin(int parentid)
{ string Returnstr = "";
Tinfodict sTinfodict = TinfodictRules.getonebypk(parentid);
DataTable table = TinfodictRules.getonebyparentid(int.Parse(TradeVal));
foreach (DataRow row in table.Rows)
{ Returnstr += "<li> <a href='#'>" + row["dictname"].ToString() + "</a></li>";//拼接li绑定到Literal }
return Returnstr;
}
/// <summary>
/// 绑定尺寸
/// </summary>
/// <param name="ChiCunID"></param>
/// <returns></returns>
public string ChiCun(int ChiCunID)
{
string returnstr = "";
Tinfodict sTinfodict = TinfodictRules.getonebypk(ChiCunID);
DataTable tab = TinfodictRules.getonebyparentid(int.Parse(ChiCunVal));
foreach(DataRow crow in tab.Rows)
{
returnstr += "<li> <a href='#'>" + crow["dictname"].ToString() + "</a></li>";//拼接li绑定到Literal
}
return returnstr;
}
}
web.config配置
<configuration>
<appSettings>
<!--<add key="excel" value="E:\项目\派瑞威行\新建文件夹\gdt_helper\webhelper\Excel\"/>-->
<add key="excel" value="G:/Perry/webhelper/Excel"/>
<add key="mailName" value="zhangshuochao@jcteam.cn"/>
<add key="mailShowName" value="zhangshuochao@jcteam.cn"/>
<add key="mailPwd" value="zhang564335"/>
<!--媒体ID-->
<add key="MediaVal" value=""/>
<!--行业ID-->
<add key="TradeVal" value="" />
<!--尺寸-->
<add key="ChiCunVal" value="" />
<!--客户ID-->
<add key="CustVal" value=""/>
</appSettings>
<connectionStrings>
最新文章
- 【leetcode】Unique Binary Search Trees (#96)
- hdu 1258 Sum It Up(dfs+去重)
- 一些简单的PGSQL 操作
- GridControl
- android:launchMode概述
- C++实现一个限制对象实例个数的类
- For Aisha(阿伊莎)
- [0] MVC&;MVP&;MVVM差异点
- C# - 设计模式 - 钩子模式
- [SQL]LeetCode183. 从不订购的客户 | Customers Who Never Order
- Linux软件包的安装(rpm+yum)
- 如何确定一个NFS的mount是v3还是v4?
- 关于报错“syntax error near unexpected token `”和回车换行
- Julia - 字符串
- java 基础 --集合--012
- COGS1752. [BOI2007]摩基亚Mokia CDQ
- mysql分组查询报错
- slice()、substring()、substr()的区别用法
- Jetty数据同步使用
- 浏览器输入一个url到整个页面显示出来经历了哪些过程?
热门文章
- 8、vue路由跳转 params与query 路由传参
- Selenium 3----窗口截图+关闭浏览器
- io 口方向调整 stm32
- LeetCode 70 - 爬楼梯 - [递推+滚动优化]
- 香茅油:不只是驱虫剂 new
- LeetCode 705 Design HashSet 解题报告
- ASM: Active Shape Models--Their Training and Application
- volatile有什么用?能否用一句话描述volatile的应用场景
- python一次性解压多层嵌套zip压缩包
- spring注解:反射与配置