zoukankan      html  css  js  c++  java
  • FormView和ListView的行数据读取分别在什么事件中.

    cs代码:
     

    1).FormView:

     protected void plantForm_DataBound(object sender, EventArgs e)
        {
            FormView me = (FormView)sender;
    //如果你要获取formview的数据.
    // Part pt=(Part)me.DataItem;//Part是这个表的类.
            if (me.DataItem != null)
            {
                if (!CanEditByMe)
                {
                    ListView contactList = (ListView)me.FindControl("contactList");
                    contactList.InsertItemPosition = InsertItemPosition.None;
                }
            }
    }

    2). ListView:

    protected void quotationList_ItemDataBound(object sender, ListViewItemEventArgs e)

        {
            ListViewDataItem item = (ListViewDataItem)e.Item;
            Quotation quotation = (Quotation)item.DataItem; //获取当前行的数据.

     

              //如果item.DataItem里的值和Quotation类里的值不是一一对应的.

              // DataBinder.GetPropertyValue(item.DataItem,"Type").ToString()   这样就可以获取某个值了.  //获取当前key.(int)me.DataKeys[e.ItemIndex].Value;


            ITextControl litUpdateOn = (ITextControl)item.FindControl("litUpdateOn");
            if (quotation.IsSubmitted)
            {
                if (quotation.UpdatedOn != null)
                    litUpdateOn.Text = Convert.ToDateTime(quotation.UpdatedOn).ToString("yyyy-MM-dd");
                else
                    litUpdateOn.Text = "UpdateOn is null";
            }
            else
            {
                ViewState["IsSubmitted"] = "IsSubmitted";
                litUpdateOn.Text = "Not Submitted";
            }
    }

  • 相关阅读:
    DGL学习(六): GCN实现
    DGL学习(五): DGL构建异质图
    DGL学习(四): 图分类教程
    LuoGuP2495:[SDOI2011]消耗战
    LuoGuP1121:环状最大两段子段和
    LuoGuP3177:[HAOI2015]树上染色
    LuoGuP2607:[ZJOI2008]骑士
    HDU4283:You Are the One
    LuoGuP4294:[WC2008]游览计划
    LuoGuP4127:[AHOI2009]同类分布
  • 原文地址:https://www.cnblogs.com/qfb620/p/1214678.html
Copyright © 2011-2022 走看看