zoukankan      html  css  js  c++  java
  • asp.net一些控件的使用

    Lable

    <asp:Label ID="Label1" runat="server" Text="Label" CssClass="font_style21"></asp:Label>

    后台cs文件对lable赋值

    this.Label4.Text = “this is a lable”;

    Button

        <asp:Button ID="Button4" runat="server" onclick="Button4_Click"
            Text="check answer" />

    TextBox

    <asp:TextBox ID="TextBox1" runat="server" Height="126px" TextMode="MultiLine"
            Width="219px"></asp:TextBox>

    后台对textbox取值与赋值:

    TextBox2.Text = this.TextBox1.Text;
    TextBox1.Text = "this is good";//str;

    RadioButtonList

    西游记中的二师兄是?<br />
        <asp:RadioButtonList ID="RadioButtonList1" runat="server">
            <asp:ListItem>小沙</asp:ListItem>
            <asp:ListItem>小猪</asp:ListItem>
            <asp:ListItem>小白</asp:ListItem>
            <asp:ListItem>小猴</asp:ListItem>
        </asp:RadioButtonList>

    得到当前选中项:

    string str=RadioButtonList1.SelectedValue.ToString();

    DropDownList

    <asp:DropDownList ID="DropDownList1" runat="server"
            onselectedindexchanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem>admin</asp:ListItem>
            <asp:ListItem>supermarket</asp:ListItem>
            <asp:ListItem>bathroom</asp:ListItem>
            <asp:ListItem>carteen</asp:ListItem>
        </asp:DropDownList>

    Image

    <asp:Image ID="Image1" runat="server" AlternateText="pic can't show"
            Height="131px" Width="156px" />

    设置图片地址:

    Image1.ImageUrl = "1.gif";

    读取数据集DataSet

    *.aspx 文件中  <%=strds%>

    DataSet ds = new DataSet();

     ds = bll.GetList(strWhere.ToString());

     string strds = "<table border=1> ";
     for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
     {
             strds = strds + "<tr>";
             for (int j = 0; j < 2; j++)
             {
                        strds+="<td class='font_style21'>"+ds.Tables[0].Rows[i][j].ToString()+"</td>";
             }
             strds = strds + "</tr>";
     }
     strds += "</table>";

  • 相关阅读:
    使用zipkin2在SpringCloud2.0环境下追踪服务调用情况
    Spring Cloud负载均衡:使用Feign作客户端负载均衡
    Spring Cloud负载均衡:使用zuul作服务器端负载均衡
    Word模板替换
    【转】Eureka集群
    巧用JavaScript语言特性解耦页面间调用(观察者模式)
    MySQL 视图触发器事务存储过程函数
    MySQL py模块的链接Navicat可视化工具
    MySQL 单表查询多表查询
    MySQL 表与表之间建立关系
  • 原文地址:https://www.cnblogs.com/huangzq/p/3119296.html
Copyright © 2011-2022 走看看