Getting an object back from my GridView rows

前端 未结 4 1839
Happy的楠姐
Happy的楠姐 2021-02-08 10:34

Basically, i want my object back...

I have an Email object.

public class Email{
    public string emailAddress;
    public bool primary;
    public int c         


        
4条回答
  •  南旧
    南旧 (楼主)
    2021-02-08 11:26

    ASP.NET Databinding is a one-way operation in terms of object manipulation. However, the DataSource property will contain a reference to your EmailCollection throughout the response:

    EmailCollection col = (EmailCollection)this.GridView1.DataSource;
    

    But I have a feeling that what you really want is a control that manipulates your EmailCollection based on user input and retrieve it in the next request. Not even webforms can fake that kind of statefulness out of the box.

提交回复
热议问题