Change jQuery Tabs from DropDownList's onchange-event - asp.net

how to select a jQuery Tab onchange of an ASP.Net DropDownList according to the selected value?

You could try something like this:
$("#dropdownClientIDHere").change(function()
{
onDropdownChange(this.selectedIndex);
});
function onDropdownChange(index)
{
$('#tabsElement').tabs("select" , index);
}
(disclaimer - not tested)
It'll select the tab matching the index of the selected item in the drop down list.
Also worth checking out the jQuery ui tabs documentation. The method you'll want to look at is select as used here.

Related

Can a checkbox in Contact Form 7 be disabled?

Can a checkbox in Contact Form 7 (Wordpress plugin) be disabled?
I have a group of 5 checkboxes, and I want one to be there, but disabled (not clickable, not selected).
How to do it?
Add an id to your to your checkbox. It will look something like this, it is important that the id is after the variable as shown below.
[checkbox variable id:disablethis "variable"]
This will put the id "disablethis" on the span tag that surrounds your checkbox (input) that you are trying to disable. Then we can simply find that span and disable all of the inputs within it like so. Put this at the bottom of your form/page.
<script>
$("#disablethis :input").attr("disabled", true);
</script>
you can disable it by using jQuery like this :
jQuery('#checkbox').attr('disabled','disabled');
where #checkbox is the ID of checkbox.
Thanks a million ImTheMechanic! I was looking for a few days how to reference the checkbox and set its state (checked or unchecked).
I had to put :input after the id.
I could never have guessed!
I did it like this:
if (dayNameB == "zaterdag") {
$("#brengtijdzat").show();
$("#brengtijdzat :input").prop("checked", true);
$("#brengtijd").hide();
$("#brengtijd :input").prop("checked", false);
}`
Thanks!

How to find out the selected row of an html table

I have made a html table in asp.net. The user clicks on a row and the corresponding page for that record is opened. How do i know which row of the table has the user selected?
http://www.electrictoolbox.com/jquey-make-entire-table-row-clickable/
$(document).ready(function() {
$('#example tr').click(function() {
alert('clicked');
});
});
How to tell which row number is clicked in a table?
without jquery
Adding an onclick event to a table row
http://jsbin.com/ivobe
try to set custom attribute of id to row(html) by assinging database id value to it.
by clicking on that row , you can get access that custom attribute by $(this).attr('your_custom_attr') and you can use that value to make ajax GET call.

In Flex, how do I create a CheckBox that can't be un-checked?

In Flex, how do I create a CheckBox that can't be un-checked? I run a function when the checkbox is clicked. If that function encounters an error, I want the state of the checkbox to remain the same. How do I do that?
You can use the enabled attribute to prevent the checkbox from being accessed once it's in the state you mentioned.
onFunctionError():void {
yourCheckbox.enabled = false;
}

How to get the selected Date from the calendar control?

Hai ,
I am creating a DatetimePicker User control. I just want to know how to get the selected date of the calendar (asp.net control) control using jQuery. I used this code, but it's wrong.
$(document).ready(function() {
$(".UserCalender").click(function () {
var a = $('.CalenderDiv:selected').text();
alert(a);
});
});
What's wrong with this?
You won't be able to do like this. There is no :selected selector for an anchor tag. It works only for <option> elements. What you can do is to attach an event hanlder to each anchor ag and use the text() method. Something like
$("#Calendar1 a").click(function(){
alert ( $(this).text() );
return false;
});
But why do you want to do this. By doing like this you will get only the text inside the anchor tag and not the whole date. To get the whole date you will have to perform additional work.
If you want to manipulate the selected text then you can use any datepicker plugin from jQuery.
See jQuery UI Datepicker

How can I get value from radio-button inserted into innerHtml

I have sort of a table with a radio-button column. I managed to make radio-button column work dynamically inserting into a cell (div if matter). But, on postback innerHtml hasn't been updated with "checked" attribute.
Could you give me an idea how can I find out (on the server) if radio-button has been checked?
More info: This is on user control inside update panel.
This would be good post on my topic, still doesn't help
Any reason you cannot use a standard asp:RadioButton and use javascript to ensure it is mutually exclusive. I have done this before by adding a custom attribute to the radiobutton and then using a js function to uncheck all items with that attribute and then check the selected one. This works around the IE issue which prevents the groupname attribute from working on radioboxes that are in different containers.
radioButton.InputAttributes.Add("ClientGroupName", "grpRadioList");
radioButton.InputAttributes.Add("onclick",
string.Format(
"javascript:radiobuttonToggle('{0}','ClientGroupName','grpRadioList');"
,radioButton.ClientID));
and use the following JS to uncheck all radios and then check the one you want.
Note i used InputAttributes instead of Attributes as the radiobutton is wrapped inside a span tag so InputAttributes is for items added to the actual input control rather than the span.
function radiobuttonToggle(selectedRB, attribName, attribValue)
{
var objRadio = document.getElementById(selectedRB);
for(i = 0; i < document.forms[0].elements.length; i++)
{
elm = document.forms[0].elements[i];
if (elm.type == 'radio')
{
if(elm.getAttribute(attribName) == attribValue)
elm.checked = false;
}
}
objRadio.checked = true;
}
You can then expose radioButton.Checked as a property in your CS file and reuse this as a control.
Check Form.Request("radio-name") != null
You only get a non-null value when it's been checked.
Make sure your page elements are being rebuilt correctly on postback. Any binding process that inserted the radio buttons the first time around will have to be re-run before you can access them the second time.
Here is a working example, first I add radios to my webform by the method you linked :
function addRadio()
{
try{
rdo = document.createElement('<input type="radio" name="fldID" />');
}catch(err){
rdo = document.createElement('input');
}
rdo.setAttribute('type','radio');
rdo.setAttribute('name','fldID');
document.getElementById('container').appendChild(rdo);
}
Then at code behind I used only the code below to get the radio's value :
string value = Request["fldID"];
So, be sure you're trying to get the name of the radio buttons at server side. You should use name attribute at server side, not id.

Resources