Donate

ASP.NET jQuery $find() Not Working In Onclick() Event Of Radio Button

In an application where i want trigger the onclick event of radio button that has a $find() method, which will retrieve the radio button's value, the code below doesn't work.
<input type="radio" id="rb1" name="format" value="format2" runat="server"  
             onclick="$find('<%=dpe1.ClientID %>').populate(this.value);" />d.m.y  
  <input type="radio" id="rb2" name="format" value="format3" runat="server"  
             onclick="$find('<%=dpe1.ClientID %>').populate(this.value);" />y/m/d  
where dpe1 is a DynamicPopulateExtender Ajax Extender.The solution I made was to remove the populate logic and transfer it to a javascript function. Here's the revised code:
//javascript code  
 function rbFunction() {  
     //$find('<%=dpe1.ClientID %>').populate($("input:radio:checked").val());  
 }  
 //html code  
 <input type="radio" id="rb2" name="format" value="format2" runat="server"  
       onclick="javascript:rbFunction()" />d.m.y  
 <input type="radio" id="rb3" name="format" value="format3" runat="server"  
       onclick="javascript:rbFunction()" />y/m/d  
Cheers!

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.

Invalid nested tag div found, expected closing tag input