Catching Unselecting All in ListView — SelectedIndexChanged Firing Twice

前端 未结 5 1056
面向向阳花
面向向阳花 2021-01-19 21:37

Basically, I have a ListView of items. When one is selected, a text box comes into view on the right to display more details of that item (takes a little time for the item

5条回答
  •  独厮守ぢ
    2021-01-19 21:59

    you can use the below code inside the event block to check whether the SelectedIndexChange event is firing directly because of the control or due to some postback event from some other usercontrols/Pages

    string id= Request.Form["__EVENTTARGET"];
    
    if(!string.IsNullorEmpty(id))
    {
    //your code here
    }
    

提交回复
热议问题