[RESOLVED]Get textbox value which is in a usercontrol using javascript

Hi,

I want to assign the value of textbox’s which are inside a usercontrol to a text box on my webform which contains the usercontrol, the values will be assigned onblur of the last text box in the usercontrol, for that i have written this function.

function txtboxonblurparty()
{

document.getElementById(‘<%= rtbAddressEng.ClientID %>’).value = "Flat No "+ document.getElementById(‘<%= txtFlatNoEng2.ClientID %>’).value +", Floor No "+ document.getElementById(‘<%= txtFloorNoEng2.ClientID%>’).value +", Building Name "+document.getElementById(‘<%=txtBuildingNameEng2.ClientID
%>’).value +", Block Sector "+document.getElementById(‘<%=txtBlockSectorLocEng2.ClientID %>’).value +", Road "+document.getElementById(‘<%=txtRoadEng2.ClientID %>’).value +", City "+document.getElementById(‘<%=txtCityEng2.ClientID %>’).value +", State: "+document.getElementById(‘<%=cboState2.ClientID
%>’).options[document.getElementById("<%=cboState2.ClientID%>").selectedIndex].text +", District "+document.getElementById(‘<%=cboDistrictEng2.ClientID%>’).options[document.getElementById("<%=cboDistrictEng2.ClientID%>").selectedIndex].text +", Pin "+document.getElementById(‘<%=txtPinCode2.ClientID
%>’).value;
}

But i am not able to get the value of the textbox’s which are inside the usercontrol. it gives me error that txtbox’s are not defined,

Plz any help would be appriciated, i am trying to get this done from past one week, searching google also did not find me any solution.

create a public property on the usercontrol which can set and get the required textbox value. you can access that property in the page to set or get the control value.

Thanks for answering, however i want to access the usercontrol textbox value in javascript and not in aspx code behind as i want to assign the usercontrol textbox value in javascripts onblur function.

any solution?

Hi,

If the textbox’s visible property is false (textbox.visible = false) then it wouldnt rendered on page. in other words ,you cannnt use JS

to acquire the content of the tag class. I dont know whether you are hiding the textbox.

Hope it helps.

Try browser name of the controls(viewsource of page)

Danny Gokey

Hi,

If the textbox’s visible property is false (textbox.visible = false) then it wouldnt rendered on page. in other words ,you cannnt use JS

to acquire the content of the tag class. I dont know whether you are hiding the textbox.

Hope it helps.

Thanks for answering, however i got it with the viewsource name of the control..

Thank You Danny.. Ya i got it with that..

Leave a Reply