zoukankan      html  css  js  c++  java
  • GW知识点

    1、取值:

            protected void Button1_Click(object sender, EventArgs e)
            {
                string str = "";
                foreach (GridViewRow row in this.GridView1.Rows)
                {
                   str += ((Label)row.FindControl("Label2")).Text + ",";
                   str+=  row.Cells[0].Text.ToString();
                }
            }
    

    2、

    <script runat="server">
    void AuthorsGridView_SelectedIndexChanged(Object sender, EventArgs e)  {
        String lastName = selectRow.Cells[1].Text;   // 针对BoundField字段
        DataBoundLiteralControl firstNameLiteral = (DataBoundLiteralControl)selectRow.Cells[2].Controls[0];  //针对TemplateField字段
        String firstName = firstNameLiteral.Text;
    }
    </script>
    <asp:gridview id="AuthorsGridView" datasourceid="AuthorsSqlDataSource"
            autogeneratecolumns="false" autogenerateselectbutton="true"
            onselectedindexchanged="AuthorsGridView_SelectedIndexChanged"  runat="server">
        <columns>
          <asp:boundfield datafield="au_lname" headertext="Last Name"/>
          <asp:templatefield headertext="FirstName">
              <itemtemplate>  <%#Eval("au_fname")%> </itemtemplate>
          </asp:templatefield>
        </columns>
    </asp:gridview>

    3、

            protected void GVListShow_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    //加入超市
                    switch (e.Row.Cells[11].Text.Trim())
                    {
                        case "True": 
                            e.Row.Cells[11].Text = "一口价";
                            e.Row.BackColor = System.Drawing.Color.PowderBlue;
                            break;
    
                        default: e.Row.Cells[11].Text = "   议价"; break;
                    }
    
                    //设为推荐
                    switch (e.Row.Cells[12].Text.Trim())
                    {
                        case "0":
                            break;
                        default: e.Row.BackColor = System.Drawing.Color.Wheat; ; break;
                    }
    
                    switch (e.Row.Cells[1].Text.Trim())
                    {
                        case "0": e.Row.Cells[1].Text = "采购"; break;
                        case "1": e.Row.Cells[1].Text = "销售"; break;
                        case "2": e.Row.Cells[1].Text = "混合"; break;
                        default: e.Row.Cells[1].Text = "未知"; break;
                    }
    
                    switch (e.Row.Cells[9].Text.Trim())
                    {
                        case "1": e.Row.Cells[9].Text = "过磅"; break;
                        case "2": e.Row.Cells[9].Text = "标重"; break;
                        case "3": e.Row.Cells[9].Text = "检尺"; break;
                        default: e.Row.Cells[9].Text = "未知"; break;
                    }
    
                    //选择
                    DateTime oldTime = DateTime.Parse(e.Row.Cells[13].Text.Trim());//dt
                    DateTime queryTime = DateTime.Parse(DotNet.Common.Date.GetDateStr());
                    if (oldTime >= queryTime)
                    {
                        CheckBox ck = (CheckBox)e.Row.FindControl("chkSelect");
                        if (ck != null)
                        {
                            ck.Checked = true;
                        }
                    }
    
                    //处理价格
                    if (decimal.Parse(e.Row.Cells[8].Text.Trim()) <= 0)
                    {
                        if (e.Row != null) e.Row.Cells[8].Text = "电议";
                        //case "2": e.Row.Cells[5].Text = "标重"; break;
                    }
                }
            }
    
  • 相关阅读:
    1113 Integer Set Partition
    1114 Family Property
    1115 Counting Nodes in a BST
    1116 Come on! Let's C
    Maven 常用命令
    Maven 快照
    Maven 插件
    Maven POM
    Maven 中央仓库
    Maven 依赖机制
  • 原文地址:https://www.cnblogs.com/chenmfly/p/4401421.html
Copyright © 2011-2022 走看看