c# - ASP.net user control doesn't call a javascript function -
i developing asp.net web application, have repeater call registered user control, have in user control button want call javascript function make ajax call action on server. button doesn't call javascript method, don't know why? , when view source found javascript function repeated every item in repeater, how eliminate repetition specially read server items inside function, , why function not called?
thanks lot!
sercontrol.ascx <div id="divbtnevent" runat="server"> <input type="button" id="btnaddevent" class="ok-green" onclick="saveevent();" /> </div> <script type="text/javascript"> function saveevent() { var eventtext = document.getelementbyid('<%=txteventdescription.clientid%>').value; // make ajax call }
problem 1: in view source found javascript function repeated every item in repeater.
solution: put js function on page on user control being called. have place js files references on page not on user control.
problem 2: trying control's value <%=txteventdescription.clientid%>. , think, control on user control.
solution: please check page source code , see control's actual clientid is.
if still have issues in calling js function, check firefox's error consol.
hope help.
Comments
Post a Comment