Getting an object back from my GridView rows

前端 未结 4 1791
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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 11:28

    Just a thought, basically a roll your own but not that tricky to do:

    Store the list that you use as a datasource in the viewstate or session, and have a hidden field in the gridview be the index or a key to the object that matches the row.

    In other words, each row in the gridview "knows" which email object in the list that it is based on.

提交回复
热议问题