I'm working on converting a DataView object to a ListView object. What I had previously was working but the source data became so long so I decided to move to ListView so I could do multiple columns.

I'm running into a few problems though. When I was working with DataView I was able to set each Item's checkbox by using OnItemDataBound. The same method for ListView is not working:

Code:
    protected void lv1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            try
            {
                CheckBox chkBox = (CheckBox)e.Item.FindControl("chkSelect");
                using (ListViewDataItem lvdi = (ListViewDataItem)e.Item)
                {
                    if (lvdi != null)
                    {
                        chkBox.ID = "dg1_" + DataBinder.Eval(lvdi.DataItem, "ServerID");
                        chkBox.Text = (string)DataBinder.Eval(lvdi.DataItem, "Server_Name");
                        chkBox.TabIndex = (short)(lvdi.DataItemIndex + 6);
                    }
                }
            }
            catch { }
        }
    }
Upon debugging, I can see chkBox.ID getting set to the new value "dg1_1","dg1_2", etc.
When I look in the source of the page, the first checkbox is name="lv1$ctrl0$ctl00$dg1_1"
However, when I do a postback using a button onClick="doPostBack"

Code:
    protected void doPostBack(object sender, EventArgs e)
    {
        ListView tdg1 = (ListView)this.FindControl("inputform1").FindControl("lv1");
...
        foreach (ListViewItem dgi in tdg1.Items)
        {
            counta += dgi.Controls.Count;
            foreach (Control cc in dgi.Controls)
            {
                debug += cc.ID;
                if (cc.GetType() == typeof(CheckBox))
                {
                    CheckBox cb = (CheckBox)cc;
                    if (cb.Checked == true)
                    {
                        Regex r = new Regex("dg1_(?<id>[0-9]+)");
                        Match m = r.Match(cb.ID);
                        if (m.Success)
...
cb.ID is always chkSelect, and not what I specified in the ItemDataBound.

Has anyone experienced this before? Am I completely insane doing it this way?