Posts

Showing posts with the label checkbox

Need to create, use and store dynamic object names in Powershell

Need to create, use and store dynamic object names in Powershell I am loading in a text file and looping through each line, and trying to print a checkbox, in a powershell form. However, the way below, all checkboxes have the same variable/object name, which makes it impossible to tell them apart. I need a way to dynamically create $checkbox0 through $checkbox(# of lines in text file, which can change), and fill them in below, as well as store the names, so i can validate if they are clicked later $pFile = Get-Content "C:results.txt" $rowCounter = 0 foreach($line in $pFile){ $checkbox = New-Object System.Windows.Forms.CheckBox $checkbox.UseVisualStyleBackColor = $True $System_Drawing_Size = New-Object System.Drawing.Size $checkbox.AutoSize = "true" $checkbox.TabIndex = $rowCounter $checkbox.Text = $line $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 25 $yValue = (20 * $rowCounter) $System_Dra...

ASP.NET delete specific rows from gridview

ASP.NET delete specific rows from gridview I need help with following problem. I try to delete specific rows from gridview. Code bellow works well, but when page is loading its show all data in database. How can I filter data? I mean when page is loading it shows nothing, but after type some text in text box, it shows me rows with that text and I can delete some of that rows with text from text box by check checkbox and button. This is my code. Pls help me. Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If IsPostBack Then GetData() End If BindGrid() End Sub Private Sub BindGrid() Dim constr As String = ConfigurationManager _ .ConnectionStrings("conString").ConnectionString() Dim query As String = "select * from TestCustomers" Dim con As New SqlConnection(constr) Dim sda As New SqlDataAdapter(query, con) Dim dt As New DataTable() sda.Fill(dt) gvAll.DataSource = dt ...

Javascript: enable buttons on checkbox' check (both with ElementsByClass)

Javascript: enable buttons on checkbox' check (both with ElementsByClass) I am sorry I have to bother you guys with such a noob question, but I am trying and googeling since two days now and I just dont seem to find the point I need, or maybe I just don't understand it. The case is the following: I have two rows in a table: 1. row checkbox - 2. row button I want the button only be enabled, if the checkbox in the same row is enabled. Picture for better understanding <input type="checkbox" class="isamed" name="attr_targeted_checkbox1"> <button type='roll' class="isroll" disabled="true"> I used classes and stumbled across getElementsByClassName and the fact, that you get an array/node of objects. I tried something like this: var buttons = document.getElementsByClassName('isroll') var keyselects = document.getElementsByClassName('isaimed'); for (var i = 0; i < keyselects.length; i++) { if (...

How to show specific text if one specific checkbox is checked among bunch of unique checkboxes

How to show specific text if one specific checkbox is checked among bunch of unique checkboxes I have a specific task to do, and I'm not sure what is the best way to do it. I have around 60 unique checkboxes and when clicked, display some text on their right side (tied to that clicked checkbox). I have done it with 64 specific eventListeners , but I'm not sure that this is the best way: I would like to simplify the code. eventListeners So, for example, I have bunch of checkboxes in a label that is: test , test1 , test2 and so on. And when I click on test checkbox, that the text: "hello world" can appear, if test1 is checked, text: "One 2 three" can appear, if test2 is checked, text: "I've done it" can appear, but if none of them is selected, texts will not be displayed. test test1 test2 test test1 test2 This is the code, one event listener I have now: var forSale = document.querySelector('#for_sale'); var forSaleEmail = document.que...