JQuery set dropdown values on button click - asp.net

I have a dropdown list and a button. When you click the button it will set all the dropdowns to a value using JQuery. The drop down is inside a div with a unique id. Is there any way I can get JQuery to set a drop down list value that is in a div without giving it a div class or id?
I've attached the html, its just three drop downs each one inside a div class.
http://pastebin.com/ne6x43QC
thanks!

$('input:submit').click(function(){
$('div > select').val(1);
})
See fiddle example.

Related

CSS: Bootstrap drowpdown hides behind grid cell

Hi Have a grid implemented third-party library AG-Grid. This grid has editable feature to edit rows.
And while editing I am rendering Bootstrap dropdown to update value of Year column as shown in below example:
Editable Grid - Dropdown Issue
When I click on the dropdown its li elements are not displaying properly as it is hidden behind the grid.
Is there any solution for this ?
This is a bit old, but for anyone else looking:
If you set the isPopup() function on your cell editor to return true you shouldn't have to fight with the CSS of the component. Allows the dropdown to render over the other cells without any CSS edits.
If you want your editor to appear in a popup (such as a dropdown
list), then you can have it appear in a popup. The popup will appear
over the cell, however it will not change the contents of the cell.
Behind the popup the cell will remain intact until after editing is
finished which will result in the cell being refreshed.

Bootstrap 3 button group Drop UP or DOWN, base on position in table container

I have problem with bootstrap drop up/down button.
Button Menu doesn't fit well on page.
I am looking for way to dynamically detect position on page of that button.
Base on location button should automatically drop up instead of drop down.
Here is problem:
on "SHOW" and "Action" button. Menu doesn't fit on page (It extends container).
https://jsfiddle.net/yz0ex8c5/
https://jsfiddle.net/3ro502q5/4/
The same happens when the button is on top. It opens Dropping up Instead of drop Down.
This is very important. Couse I use this buttons with drop down and drop up in table that can be sorted. I use Bootstrap-table library to sort rows in table.
You could check the scrollTop position for the page, then switch between .dropup or .dropdown according to what is most suitable.
$(window).scroll(function() {
var scrollTop = $("body").scrollTop();
if (scrollTop<50) {
$("#showBtnGroup").removeClass('dropdown').addClass('dropup');
} else {
$("#showBtnGroup").removeClass('dropup').addClass('dropdown');
}
});
forked fiddle -> https://jsfiddle.net/wenz3v5r/
Have given the btn-group an id for easy access. The evaluation value of 50 is completely arbitrary, have just added a lot of <br>'s to the bottom and the top of the page - that must depend on how your site looks like IRL. You should do the same (or rather the opposit) with the Action dropdown at the bottom.

Pop up box when hover over div

I am using asp.net in VS 2013.
I want to display a pop up window when a user hovers over a div. I have 3 divs on the page and they are each a square of approx. 50x50. When the user brings their mouse over each one I want a different pop up box to appear.
I have been playing about with the hovermenuextender to achieve this but Im not getting anywhere as it needs a control as its target. IS there anyway to achieve this with an Ajax control?
thanks
You can try this:
step 1: Keep the three pop ups with different ids in your html with style = "display:none;position:absolute;top:50%;left:50%;". and a classname popup.
e.g.
<div class="popup" id="1" style = "display:none;position:absolute;top:50%;left:50%;"></div>
step 2: Give classname (respective ids of hidden divs) to your divs on which user will hover and a parent attribute to your divs.
e.g.
<div class="showdiv" parent="1"></div>
step 3: now write following code:
$(document).ready(function() {
$('.showdiv').mouseover(function() {
$(".popup").hide();
$("'#"+$(this).attr('parent')+"'").show();
});
});
try prop if attr doen't work.

How to change the Ajax combo box list items width dynamically from code behind?

I have a Ajax combo box whose width is set from a css class, i want to change the width of list items (the area which appears after we click the button on combo box present at right side). from the code behind.
I've set the width of listitems from css like
.ComboboxWidth ul
{
width:176px !important;
}
This works. But i've to do same thing from code behind, can anybody guide?

How to Add Radio Buttons to a Form Vertically?

I am dynamically creating radio button within code behind in ASP.Net, how do I add the controls so they appear vertically instead of horizontally?
RadioButtonList rbl = new RadioButtonList();
rbl.RepeatDirection = RepeatDirection.Vertical;
You can use RadioButtonList Control with RepeatDirection set to Vertical.
If that is not possible then....
Add them to a ordered list(OL element) or an unordered list(UL).
Possible two ways:
Give some CSS class, and in your css give that class some style like
display:block;
Use RadioButtonList control as container to those radio buttons. Set the "RepeatDirection" property to "Vertical".

Resources