I have a sharepoint website which has multiple instances of the same visual webpart. On button click I am trying to get a textbox present in the usercontrol of the webpart using document.getelementbyid('<%textboxID.ClientID%>'). I get a textbox but it is always from the last instance of the webpart.
I have seen few articles related to document.getelementbyid not returning the controls according to their ID but think that's not the case here as I get a relevent control but from a diffrent instance of webpart.
Below is the srtipped down version on the web part's user control,
This webpart is dropped on a sharepoint webpage 3-4 time with slightly diffrent configurations. As I started earlier, the Excel_Clicked() function tries to get 'txtReportName' textbox on the current webpart but ends up with the textbox in the last instance of webpart . Needless to say that if there is only one instance of the webpart it work fine.