zoukankan      html  css  js  c++  java
  • Literal绑定数据

    前台:

    <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(876);//行业主键ID=876。餐饮服务,电商服务,电子商品附ID为876
               ChiCunShow.Text = ChiCun(880);//尺寸主键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;
        }
    }
    View Code

    web.config配置

    <configuration>
      <appSettings>
        <!--<add key="excel" value="E:项目派瑞威行新建文件夹gdt_helperwebhelperExcel"/>-->
        <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="21"/>
        <!--行业ID-->
        <add key="TradeVal" value="876" />
        <!--尺寸-->
        <add key="ChiCunVal" value="880" />
        <!--客户ID-->
        <add key="CustVal" value="21"/>
      </appSettings>
        <connectionStrings>
    View Code
  • 相关阅读:
    背包问题
    標準差、方差、正太分佈公式
    C#實現XML的增刪查改
    XML的基礎結構
    微信小程序入門學習資料鏈接
    微信小程序wxml無法實現頁面跳轉的問題
    088_jsp转成成servle所在的路径?
    075_jsp如何debug?
    028_Mybatis返回int类型为空时报错 attempted to return null from a method with a primitive return type (int)
    087_数据库类型
  • 原文地址:https://www.cnblogs.com/YiZhiZaiNvLi/p/4104219.html
Copyright © 2011-2022 走看看