Hello, Welcome to my blog. If you like feel free to refer others

Tuesday, 7 August 2012

Nested user controls and javascript getElementById

This is the code to find control in WebUserControl which nested in your aspx page.
Suppose the popup.ascx's ID is popupControl and the locations.ascx's ID is locationControl
To find "drpLocationList" which in location.ascx we can use the below mentioned code:

var ddlLocation = document.getElementById('<%=popupControl.FindControl("locationControl").FindControl("drpLocationList").ClientID%>');

Disable History on Textbox

For Framework version 2.0 and above: 
Set the AutoCompleteType property to Disabled for the textbox.

For other framework version :

TextBox1.Attributes.Add("autocomplete", "off")