Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Get ClientID of asp:TextBox in an asp:FormView nested in an ajax:TabContainer

Avatar of Alan Warren
Alan WarrenFlag for Philippines asked on
JavaScriptASP.NET
7 Comments1 Solution2798 ViewsLast Modified:
I am trying to get the ClientID of an asp:textbox control that is in the edit template of an asp:FormView, which is nested in an ajaxToolkit:TabContainer.TabPanel

This posted code snippet works, but uses the static name of the element which I got by viewing the page source.
I would like to get the name dynamically.

Using the following returns 'undefined'
 document.getElementById('<%=AssessmentFormView.FindControl("AxDate1TextBox").ClientID%>').focus()

Alan ";0)

function AxDate1TextBox_Clicked() 
      { 
          try {
            //Run some code here
            var FormViewMode = ('<%=AssessmentFormView.CurrentMode.ToString() %>');
            if (FormViewMode = 'Edit') // FormViewMode.Edit = 1
            {
              //alert(FormViewMode);
              var TheTextBox = $get("ctl00_ContentPlaceHolderMainsection_Tabs_TabPanel2_AssessmentFormView_AxDate1TextBox");
              TheTextBox.focus();
              return false;
            }
            else {
              return false;
            }
          }
          catch (err) {
            //Handle errors here
            alert(err.description);
          }
      }
ASKER CERTIFIED SOLUTION
Avatar of karthitron
karthitronFlag of India image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answers