11 reputation
6
bio website msdn.microsoft.com/en-US/b/…
location Bangalore, India
age 34
visits member for 1 year, 8 months
seen Feb 28 '13 at 11:49

Software Developer from Bangalore, India. Primarily working in ASP.NET and Sharepoint.


Nov
19
awarded  Popular Question
Jan
23
comment Unable to get correct element on a sharepoint page using document.getelementbyid('<%textboxID.ClientID%>')
The ascx is added to the page via webparts. The ReportName ID gets decorated something like, 'ctl00_m_g_496598a6_dd5d_4aa8_aa2d_84dd6a2ad815_ctl00_txtReportName. So it's unique on the page...but the call '<%=("txtReportName").ClientID %>' might not give proper result as there would be multiple controls with the server side ID, txtReportName. Hence what woudl be the workarounf in this situation. document.getElementById('<%= Page.Master.FindControl("txtReportName").ClientID %>') will also run into the same issue as there is no way to decide upon which exact control we are looking for.
Jan
23
awarded  Autobiographer
Jan
23
awarded  Informed
Jan
23
awarded  Student
Jan
23
comment Unable to get correct element on a sharepoint page using document.getelementbyid('<%textboxID.ClientID%>')
Well I am able to get the value inside the textbox just fine. Problem is that the textbox selected is incorrect. There are 3 instances of this webpart on the page. If is click on the button in the first instance doucment.getElementById is giving me a textbox from the last instance. (I can tell that from the value returned.)
Jan
23
awarded  Editor
Jan
23
revised Unable to get correct element on a sharepoint page using document.getelementbyid('<%textboxID.ClientID%>')
Added stripped down version of the webparts ascx
Jan
23
comment Unable to get correct element on a sharepoint page using document.getelementbyid('<%textboxID.ClientID%>')
This is how i am using it, var reportname = document.getElementById('<%=txtReportName.ClientID%>').value;
Jan
23
awarded  Analytical
Jan
23
asked Unable to get correct element on a sharepoint page using document.getelementbyid('<%textboxID.ClientID%>')