Click here to Skip to main content
15,898,010 members

Comments by .Net Jim (Top 1 by date)

.Net Jim 8-Jan-15 14:59pm View    
OK. Something else has come to my attention. You are mixing things up and this is why things are firing multiple times.

ViewState is a cache for the entire web page. It is not advisable to tap into it from a multiple event situation like rowdatabound. You should tap into your rows of data by grabbing data from sender. Sender is a copy of the control creating the event, and the args are the settings for the object, not the data.

Follow how you see it done here, making sure to search for your control, then set the value. Also, this works much better if you set some column templates with names for the controls.

I will try to find a youtube tutorial later, but this article will give you plenty of code to tap into your grid from sender object. Viewstate should only be done once or twice on page from event that only fires once or twice during page load sequence of events, maybe from button click. Rowdatabound is called with every row of your grid, so performance will slow down also.

http://www.codeproject.com/Answers/305101/Set-Eval-in-Code-Behind#answer2