selected

How to make the f.select rails selected

眉间皱痕 提交于 2019-12-03 15:20:20
问题 It's my code: <%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']]), {}, {:class => 'span3 controls controls-row'}, :selected => params[:area] %> and result is: ArgumentError in Users#edit Showing /home/airson/rails_projects/friends_of_local/app/views/users/edit.html.erb where line #17 raised: wrong number of arguments (5 for 4) why.....@@? 回答1: No need to use :selected just pass your params[:area] alone to options_for_select as a second argument: <%= f.select :area, options

Get the indexes of selected rows in GridView

只谈情不闲聊 提交于 2019-12-03 14:43:03
问题 I want get the rows I selected from gridview use a checkbox. The checkbox is like this! <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" oncheckedchanged="CheckBox1_CheckedChanged" /> </ItemTemplate> </asp:TemplateField> And I want to get one column in each row. How to do it.thx! 回答1: try this: protected void CheckBox1_CheckedChanged(object sender, System.EventArgs e) { CheckBox checkbox = (CheckBox)sender; GridViewRow row = (GridViewRow

jQuery remove selected option from this

大城市里の小女人 提交于 2019-12-03 10:38:46
问题 first post here, I come in peace :) I've searched but can't quite find what I'm after. I am trying to manipulate the selected option of a select box. Can someone please explain why this works: $('#some_select_box').click(function() { $('#some_select_box option:selected').remove(); }); but this doesn't: $('#some_select_box').click(function() { $('this option:selected').remove(); }); I just want to use "this" instead of spelling out the id of the select box - can someone point me in the right

C# Listbox set selected item

大城市里の小女人 提交于 2019-12-03 08:06:58
i have a C# listbox with the values Profile 1 Profile 2 Profile 3 I want to have Profile 2 selected when the form loads. How do I do this? Set the ListBox.SelectedIndex property in the Form.Shown event. For example: public Form1() { InitializeComponent(); // Adding the event handler in the constructor this.Shown += new EventHandler(Form1_Shown); } private void Form1_Shown(object sender, EventArgs e) { myListBox.SelectedIndex = 1; } Put following code in Form.Loaded event: listBox1.SelectedItem = "Profile 2"; listBox1.Items.Add("Profile 1"); listBox1.Items.Add("Profile 2"); listBox1.Items.Add(

How to make the f.select rails selected

与世无争的帅哥 提交于 2019-12-03 04:59:47
It's my code: <%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']]), {}, {:class => 'span3 controls controls-row'}, :selected => params[:area] %> and result is: ArgumentError in Users#edit Showing /home/airson/rails_projects/friends_of_local/app/views/users/edit.html.erb where line #17 raised: wrong number of arguments (5 for 4) why.....@@? No need to use :selected just pass your params[:area] alone to options_for_select as a second argument: <%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']], params[:area]), {}, { :class => 'span3 controls controls-row' }

Get the indexes of selected rows in GridView

泪湿孤枕 提交于 2019-12-03 03:40:03
I want get the rows I selected from gridview use a checkbox. The checkbox is like this! <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" oncheckedchanged="CheckBox1_CheckedChanged" /> </ItemTemplate> </asp:TemplateField> And I want to get one column in each row. How to do it.thx! try this: protected void CheckBox1_CheckedChanged(object sender, System.EventArgs e) { CheckBox checkbox = (CheckBox)sender; GridViewRow row = (GridViewRow)checkbox.NamingContainer; if (checkbox.Checked == true) { row.BackColor = System.Drawing.Color.Red; mygridview

How to set the 'selected option' of a select dropdown list with jquery

五迷三道 提交于 2019-12-03 03:38:25
问题 I have the following jquery function: $.post('GetSalesRepfromCustomer', { data: selectedObj.value }, function (result) { alert(result[0]); $('select[name^="salesrep"]').val(result[0]); }); result[0] is a value that I want to set as the selected item in my select box. result[0] equals Bruce jones . the select box is populated by a database query but one of the rendered html is: <select id="salesrep" data-theme="a" data-mini="true" name="salesrep"> <option value=""> </option> <option value=

jQuery remove selected option from this

故事扮演 提交于 2019-12-03 01:09:59
first post here, I come in peace :) I've searched but can't quite find what I'm after. I am trying to manipulate the selected option of a select box. Can someone please explain why this works: $('#some_select_box').click(function() { $('#some_select_box option:selected').remove(); }); but this doesn't: $('#some_select_box').click(function() { $('this option:selected').remove(); }); I just want to use "this" instead of spelling out the id of the select box - can someone point me in the right direction for the correct syntax? It's driving me mad because it looks like it should be really simple.

Custom UI TableViewCell selected backgroundcolor swift

╄→尐↘猪︶ㄣ 提交于 2019-12-02 20:47:24
I am trying to change the appearance of a custom selected TableViewCell using Swift. Do I need to do it via the designer or programmatically? I tried the following: And here is my code: @IBOutlet var tableView: UITableView! var tableData: [String] = ["One", "Two", "Three", "Four"] override func viewDidLoad() { super.viewDidLoad() // Register custom cell var nib = UINib(nibName: "vwTblCell", bundle: nil) tableView.registerNib(nib, forCellReuseIdentifier: "cell") } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.tableData.count } func tableView

jqGrid how to collapse row when clicking on other row

醉酒当歌 提交于 2019-12-02 20:06:40
问题 In a main grid, when I click on one row, it become 'highlighted' and the seven subgrids are showed. Here is an example where first row is selected, and near to be edited (work in progress) : Now, if I click on second row of the main grid, the first is hidden and the second selected. I click after on edit button and a warning appears : no selected row ! If I click again on the second row, it become unselected, and again I click for selecting and editing, that runs fine ! So I presume that my