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";
            }
    }

  • 相关阅读:
    Spring_3.1
    handler发消息的形式
    css元素排列
    利用Socket远程发送文件
    jtree添加节点
    url传参中文乱码
    struts action和jsp之间的传值
    Struts 404 The requested resource is not available
    tomcat server需要重启的时刻
    c++获取系统时间(引用别人的博文)
  • 原文地址:https://www.cnblogs.com/qfb620/p/1214678.html
Copyright © 2011-2022 走看看