selecteditemtemplate

Programmatically Select Item in Asp.Net ListView

若如初见. 提交于 2019-11-27 19:56:13
After doing a quick search I can't find the answer to this seemingly simple thing to do. How do I Manually Select An Item in an Asp.Net ListView? I have a SelectedItemTemplate, but I don't want to use an asp:button or asp:LinkButton to select an item. I want it to be done from a URL. Like a QueryString, for example. The way I imagine would be on ItemDataBound, check a condition and then set it to selected if true, but how do I do this? For example: protected void lv_ItemDataBound(object sender, ListViewItemEventArgs e) { using (ListViewDataItem dataItem = (ListViewDataItem)e.Item) { if

Programmatically Select Item in Asp.Net ListView

时光毁灭记忆、已成空白 提交于 2019-11-26 20:03:45
问题 After doing a quick search I can't find the answer to this seemingly simple thing to do. How do I Manually Select An Item in an Asp.Net ListView? I have a SelectedItemTemplate, but I don't want to use an asp:button or asp:LinkButton to select an item. I want it to be done from a URL. Like a QueryString, for example. The way I imagine would be on ItemDataBound, check a condition and then set it to selected if true, but how do I do this? For example: protected void lv_ItemDataBound(object