webform 基础

Repeater的使用:

<asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <div class="kuang">
                    <div class="left">
                        <img src="<%#Eval("touxiang") %>" />
                    </div>
                    <div class="name"><%#Eval("name") %></div>
                    <div class="ziliao"><%#Eval("nationname")  %></div>
                </div>
            </ItemTemplate>
        </asp:Repeater>
using(DBDataContext con=new DBDataContext())
        {
            Repeater1.DataSource = con.people;
            Repeater1.DataBind();
        }

 

 --------------------

-AutoPostBack="true"                  --此属性才可在后台调用DropDownList的方法

if (IsPostBack == false)               ---仅第一次加载有效

</AlternatingItemTemplate>                   --交替绑定数据

document.getElementById("HiddenField1").value = this.getElementsByTagName("img")[0].getAttribute("src");             --取图片路径的方法

Literal:在Html中输出代码(一般用于<script><script> )                --类似于reponse,比reponse更好

 <div style="clear: both;"></div>               --清流

 

-----------------------------

用html页面 发送请求:

建立一个html页面网站,建立一个 一般处理程序 (handler.ashx)

<form action="handler.ashx" method="post">

  <input type="text" name="username"/>

</from>

 

handler.ashx页面中:

  string username=context.request["username"];    --取html页面中的内容

  using(dbdatacontext con=){}    --可以执行linq语句

 --------------------------------

posted on 2017-12-17 11:08  段了的弦  阅读(154)  评论(0编辑  收藏  举报