Link to home
Start Free TrialLog in
Avatar of mrferrari
mrferrariFlag for United States of America

asked on

ASP.Net change radio button via javascript from onblur attribute

Please help. I have a radio button group with two buttons and one text box. If the user clicks into and then out of the text box I want to check if the user has changed the value from the default (which is 0) and if the user has changed the value I want the radio button to automatically switch to yes (which is the second item in the radio button group index).

I added the onblur attribute to my textbox and have tried to get the javascript going with all sorts of methods to no avail...

tbxBid.Attributes.Add("onblur", String.Format("CheckBoxChange(this.value,{0},{1});", tbxBox.ClientID, rdbGroup.ClientID))
 
    <script type="text/javascript">
        function CheckManualEntry(value, txtBoxName, rdbName) {
            var old_price = txtBoxName.getAttribute("value");
            var rb = document.getElementsByName(rdbName);
            rb[1].checked = true;
        }
    </script>

Open in new window

Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image


set your autopostback to true.
add an ontextchanged event handler.
AJAX it.
Avatar of mrferrari

ASKER

I want to use javasciprt. this is really small and simple. i cant figure it out though.

I don't want the page to autopostback...
I don't understand the scope beyond just the basics you outlined. I was a little confused by your attribute assignment in the code behind because you were calling on ID's that you hadn't mentioned in your question (tbxBid and tbxBox). All that is to say I may have missed the mark because I had to simplify without having more information...

Anyway this should give you an idea of how to begin managing the situation. I just wrote something that addresses the very specific things you mentioned. Of course I imagine you have a bigger scope and will have to update it accordingly...
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4913559
Member_2_4913559
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
bingo bango... that works great. thanks so much...