.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Clearing RadiobuttonList using jquery does not preserve its value when attached to textChanged event

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

Hello everybody,

Well, i have a simple ASP.NET 3.5 page with a Radiobuttonlist with 2 items (Yes/NO). there are also 2 Buttons. The 1st button has a client side jQuery code that clears the selected value in the radiobuttonlist. The second button just postback the page when clicked and has no event handler.

Now, everything works fine, so when we select a value in the radiobuttonlist (ex: Yes), then we click the 1st button, the value is cleared, and clicking on the 2nd button, the page posts back and the radiobuttonlist control will not have any value selected. (That's GOOD for now).

Now, if we attach the textChanged or SelectedIndexChange events to the RadioButtonList (with no server side code in them), and repeat the above senario, what will happen is that after postback, the radiobuttonlist value will NOT BE CLEARED, and it will revert to the last selected value before postback. This is very weird. I don't know why it behaved like this.

Have anyone faced this issue, and how can we solve this. Please Help.




View Complete Post

More Related Resource Links

Composite control: How to bubble a textbox's TextChanged event?


I've created a composite control that contains several controls, including a textbox. I'm trying to expose the TextChanged event of the textbox as an event on the composite control. I understand that events can be bubbled up the control hierarchy and handled at a higher level, which I've attempted to do, but I can't get the bubbled event to fire. When I drop the control on an aspx I can see the TextChanged event, I can subscribe to the event, but nothing ever happens. Any suggestions? Here is what I think is the relevant code:

// My event
private static readonly object EventTextChanged = new object();

//Handle the bubbled event
EventHandler textChangedHandler = (EventHandler)Events[EventTextChanged];

protected override bool OnBubbleEvent(object source, EventArgs e) 
    bool handled = false;

determine the best way to refresh a gridview when textchanged event occurs


Good afternoon.

I have the following gridview inside an updatepanel that makes the bind from a datatable:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
                <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" 
                    CssClass="Grid" Width="100%" CellPadding="4" ForeColor="#333333" 
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <asp:Button ID="AbrirModal" runat="server" Text="->" /> 
                                <asp:PopupControlExtender ID="PopupControlExtender1" runat="server"

jquery click event doesn't fire after postback anymore

Hello there,I have a small website where I want to display a confirmation dialog after clicking on a button.When you click the confirmButton the dialog appears. Then you can choose between Yes or No to either continue with the PostBack or to return.Problem: The first time you get into the site all works fine. But after you click Yes to continue with the PostBack, no click event will be triggered anymore.Here is some code.<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript"> function loadConfirmDialog() { //Dialog configurieren jQuery('#confirmDialog').dialog({ autoOpen: false, width: 400, modal: true, resizable: false }); //Dialog öffnen jQuery('#confirmButton').bind('click', function () { jQuery('#confirmDialog').dialog('open'); return false; }); //Postback ausführen jQuery('#continueButton').bind('click', function () { jQuery('#confrimDialog').dialog('destroy'); __doPostBack('confirmButton', ''); }); //Postback abbrechen jQuery('#cancel

jQuery radiobuttonlist

Hi,I'm trying to show/hide a div based on the selected value of radiobuttonlist using jQuery (1.3.2.min). I've tried a thousand different methods and can't get any of them to work :( I have the following code so far:<asp:RadioButtonList ID="rdbMeds" CssClass="assess" RepeatLayout="Flow" RepeatDirection="Horizontal" runat="server"> <asp:ListItem value="yes">Yes</asp:ListItem> <asp:ListItem value="no" Selected="true">No</asp:ListItem> </asp:RadioButtonList> <div id="rdbMeds_hid"> If yes, please specify what it is for: <asp:TextBox ID="tbMeds" CssClass="textboxnormal" runat="server" /> </div> And I have the following jQuery:$(document).ready(function(){$("#rdbMeds").change(function(){//If checkedif ($("#rdbMeds").attr(":checked")){//show the hidden div$("#rdbMeds_hid").show("fast");} else { //otherwise, hide it $("#rdbMeds_hid").hide("fast");}});});Any help would be much appreciated.

textChanged event doesnot work

hi friend TextChanged event for a textbox doesnot work when i change the text inside the textboxi added this code to textchanged event method in my website code-behindprotected void passwordTxt_TextChanged(object sender, EventArgs e)        {            char[] pass = passwordTxt.Text.ToCharArray();            for(int i=0;i<pass.Length;i++)            {                if (Char.IsDigit(pass[i]))                    digit++;                else if (Char.IsLetter(pass[i]))                    letter++;            }            if (digit >= 1 && letter >= 1)                errorPassLbl.Text = "Strong";        

Get dropdownlist event OnSelectedIndexChange using jquery

I have dropdownlist that located inside a repeater, how can i get OnSelectedIndexChange event of this dropdownlist? i want to use this event to set TextBox value olso inside this repeater, i try this code$("#Table1> tbody > tr ").each(function() { var rowId = $(this).attr("id"); $(this).find("td > #DropDownList1").change(function() { $("#" + rowId + "> TD:nth-child(6) > input[name$='TextBox1']").val("Test"); }); }); But did not work, can anyone please help me?

button event using jquery

 I have a button control that need to show a div when clicked. I wrote the following code, however is not working. I am new to jquery and wanted to use the "show()" function. Please advise.   <html> <head> <script src="jsquery.js" type="javascript"></script> <script type="javascript">   Function showdiv()   {    $('#<%=btn1.clientid%>').click(function() {        $("#div1").show("slow");       });     }    </script> </head> <body> <asp:button id="btn1" runat="server" text="Show" onclientclick = "showdiv()"  /> <div id="div1" style="display:none;"> <p>Hello World</p> </div> </body> </html>        

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

JQuery Autcomplete with blur event on Html.TextBoxFor

Hello,                 I have a strange problem in my application.whenever i select a suggestion from the autocomplete(jquery) textbox, it first fires a blur event of a textbox first.(When i click the suggestion using mouse). But i want to fire blur event later.What should i do?Please help.   thanx in advance.  

how to call a event another page & refresh other page jquery

!) i have two page a with event   Bu_DocSearch_Click (object sender, System.EventArgs e)  i require it call another page and reftesh automatically protected void Bu_DocSearch_Click (object sender, System.EventArgs e){            //+" order by a.ID";            string sql="";            string S_SubjectContain=CCUtility.ToSQL((Utility.GetParam("txt_SubjectContain")+"%"),FieldTypes.Text);;            string Find=" and a.Subject Like "+S_SubjectContain;            //string Find=" and a.Subject ='"+S_SubjectContain+"%'";                                ArrayList SelectedChkBox =new ArrayList();                SelectedChkBox =Utility.CheckboxSelected(CheckBoxBind);                    string Inclause="";            for(int i=0;i<SelectedChkBox.Count;i++){ 

Get asp.net radiobuttonlist selected value in code behind when using jQuery buttonset


I am using the jQueryUI buttonset on an ASP.NET radiobuttonlist. I need to get the selected value in server-side code when the page posts back. If I don't apply the jQuery buttonset, this is of course easy enough - just grab "SelectedValue". However, when I do apply jQuery buttonset, the selected value does not appear to be available on postback any longer. Is there any way around this, or do I need to get the selected value on clientside, and then pass it back myself?

<asp:RadioButtonList ID="RadioButtonList0" CssClass="ratingButtons" runat="server">
    <asp:ListItem Text="Option1" Value="1"/>
    <asp:ListItem Text="Option2" Value="2" />
    <asp:ListItem Text="Option" Value="3" />
    <asp:ListItem Text="Option4" Value="4" />

  $(function () {
      $(".ratingButtons").click(function () { return false; });


AjaxControlToolkit TextBoxWatermarkExtender fires TextChanged Event on every postback


I haven't been able to find anything on the net about this yet. A project that used to work fine all of a sudden started having trouble with a couple users. The TextBoxWatermarkExtenders for these users are now always firing the TextChanged event of the textboxes they are assigned to for every postback. I don't think this is what they are supposed to do. They didn't use to do this. Has anyone else experienced this? I can add code to ignore these unintentional events, but I would like to know why all of a sudden the change in behavior.

Any information about this would be greatly appreciated.


jquery - span text changed event


is there a jquery event that is fired when the text of a span element is changed? The change event does not apply to <span> elements. I see reference to "text changed", but $('#PriceCond').bind('textchange', function(event, prevText) { ... }) ; does not work either.



     <input type="button" id="TestButton" value="Test" />

     <span id="PriceCond"></span>

<script type="text/javascript">
  $(document).ready(function ()

    var clickFunc =
          function ()
            var s1 = $('#PriceCond').text();
            $('#PriceCond').text(s1 + 'x');

    var priceChangeFunc =
          function ()
            alert('in priceChangeFunc');





Clearing a RadioButtonList with javascript


I'm posting this here because my question isn't really about the javascript itself but about the workings of the RadioButtonList control.  I have a webforms application where a several radiobuttonlist controls are rendered dynamically from server side code.  I want to also render an undo button that will clear the associated radiobuttonlist.  I can get it to work fine using an image button that does a postback.  However, I'd like to do it without the postback, waiting until the entire form is filled out before posting back via a submit button.  I've been able to get it to clear the radio buttons via javascript.  However, when I click submit to post back to the server, the server thinks the radiobutton is still selected.  Here's a condensed version of the code that renders the controls.

Dim tbl As New Table
For x = 1 to 10
Dim rbl As New RadioButtonList
With rbl
.ID = "rbl_" & x
.AutoPostBack = False
.RepeatLayout = RepeatLayout.Table
With .Items
.Add(New ListItem("0","0"))
.Add(New ListItem("1","1"))
.Add(New ListItem("2","2"))
End With
End With
Dim imgUndo As New Image
With imgUndo
.ID = "Undo_" & x
.ImageUrl = "~/images/undo.png"
.Attributes.Add("onclick", String.Format("

Newbie question re: asp.net textbox + jquery change event


Hello guys,

I thought I was coding a change event correctly, yet somehow i'm not getting any result

I made the simplest of examples to accomplish what i want

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

asp:textbox TextChanged event


I have a textbox in my app in which I have code behind in the "onTextChanged" event that I'd like to execute  without doing an entire page post back . 

I can't use use AJAX not an option for me (corporate thing). 

Anyways, I have been struggling with the specifics on implementing ICallbackEventHandler. Or is than another way I can/should do this.

The code in the textChanged event pulls a dataset from the DB and does a validation.

Any advice is appreciated.





TextBox TextChanged event not triggered


I have a textbox, under a specific circumstance, its textchanged event doesn't fired.

the keydown and previewkeydown do fired.

I assume there are other control intercept the keydown event and fool around it, probably did something over it.

but what can caused the textchanged event being cut off?

or any debugging approach for this?

i tried the AddHandler to the textchanged, in case its handled prop set to true that caused the cut off. but same, the event still don't get triggered under that special circumstance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend