weivarryexory
New Member
I have a masterpage in which i defined a function for \[code\]getElementById\[/code\] .\[code\]function Clear() { document.getElementById('<%= NameTextBox.ClientID %>').valuehttp://stackoverflow.com/questions/14036902/= ""; document.getElementById('<%= LastNameTextBox.ClientID %>').valuehttp://stackoverflow.com/questions/14036902/= "";}\[/code\]when i use this function in other page it is clearing the element value.but when i use this code in masterpage, i get error :\[quote\] The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).\[/quote\]\[code\][HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] System.Web.UI.ControlCollection.Add(Control child) +9601391AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) +691AjaxControlToolkit.ScriptControlBase.OnLoad(EventArgs e) +44System.Web.UI.Control.LoadRecursive() +54System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Control.LoadRecursive() +145System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772\[/code\]if i change my code to :\[code\]document.getElementById('<%# NameTextBox.ClientID %>').valuehttp://stackoverflow.com/questions/14036902/= "";\[/code\]i don't get error. but don't clear myelement.