Getting SubItem from listview

前端 未结 3 1132
梦毁少年i
梦毁少年i 2021-01-14 05:58

I am trying to get Subitem from a list view, I did this but doesn\'t work:

curItem1=listView2->Items[i]->Text;

curItem2=listView2->SubItem[i]->T         


        
3条回答
  •  旧时难觅i
    2021-01-14 06:20

    You want to access the Text property of a certain control inside the ListViews ItemTemplate. This is done similarly to this:

    string curItem = ((TextBox)listView2.Items[i].FindControl("TextBox1")).Text;
    

    Where 'TextBox1' is the control you are trying to get the Text property of. You also need to make sure that you are casting to the correct type of the Control you are trying to get the property for.

提交回复
热议问题