How do I set a checkbox to checked when another checkbox in a DG row is checked?

I have a datagrid with rows of labels, textboxes, and checkboxes.  These rows show information about customers.  When a user checks one of the checkboxes, I need the other textbox to become checked as well.  When the user unchecks the checkbox, nothing should happen.  See code below.  Any ideas?  The trick is finding the checkbox control for that specific row.  Thanks!!!!

<asp:GridView ID="CustomFieldsGridView" width="100%" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomizableFieldCode"

DataSourceID="CustomFieldsObjectDataSource" ShowHeader="False">

<HeaderStyle CssClass="WhiteFormListHeader"/>

<RowStyle CssClass="GridViewListItem" />

<SelectedRowStyle CssClass="GridViewSelectedListItem" />

<AlternatingRowStyle CssClass="GridViewAlternatingListItem" />


<asp:BoundField DataField="CustomizableFieldCode" HeaderText="CustomizableFieldCode"

InsertVisible="False" ReadOnly="True" SortExpression="CustomizableFieldCode"

Visible="False" >


<asp:BoundField DataField="DefaultLabel" HeaderText="DefaultLabel" SortExpression="DefaultLabel" ItemStyle-CssClass="GridViewFirstField">

<ItemStyle Width="170px" />


<asp:TemplateField><ItemTemplate><asp:CheckBox AutoPostBack="true" ID="IsVisibleCheckBox" runat="server" Enabled='<%#Eval("AllowCustomVisible") %>' Checked='<%# this.SetVisible((bool)Eval("IsVisible"),(bool)Eval("IsRequired")) %>' OnCheckedChanged="HandleVisibilityChange" /></ItemTemplate>

<ItemStyle Width="80px" />


<asp:TemplateField><ItemTemplate><asp:CheckBox AutoPostBack="true" ID="IsRequiredCheckBox" runat="server" Enabled='<%#Eval("AllowCustomRequired") %>' Checked='<%# this.SetRequired((bool)Eval("IsVisible"),(bool)Eval("IsRequired")) %>' OnCheckedChanged="HandleRequiredChange" /></ItemTemplate>

<ItemStyle Width="80px" />


<asp:TemplateField><ItemTemplate><asp:TextBox ID="CustomizedLabelTextBox" Width="310px" MaxLength="50" runat="server" Text='<%#Eval("LabelName") %>' Visible='<%#Eval("AllowCustomLabel") %>' OnTextChanged="HandleLabelChange" ></asp:TextBox></ItemTemplate>

<ItemStyle Width="346px" />





5/13/2006 5:16:23 PM 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 46

  Suppose IsVisiblityCheckBox controls the IsRequiredCheckBox
 protected void HandleVisiblityChanged(object sender, EventArgs e)
         CheckBox cb;
         cb = GridView1 .Rows[GridView1.EditIndex].FindControl("IsRequiredCheckBox") as CheckBox;
             cb.Checked = true;
5/15/2006 8:45:38 AM

Similar Artilces:

checking checkbox is checked or not using checkbox.checked
Hi,my checkbox is<asp:CheckBox ID="Chkcity" runat="server" Text="My own city"  OnCheckedChanged="EventHandler"/>code behind: Private Sub Chkcity_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chkcity.CheckedChangedif (Chkcity ...............)end if End SubERROR    'EventHandler' is not a member of 'ASP.bpoaddjob_aspx'.    Please Mark the post as "ANSWER" if it helps you I think it should be like this:<asp:CheckBox ID="Chkcity"...

how to check all the row level checkbox when header level checkbox is checked
hello i m working on one site which requires the functionality like yahoo, that is when we check header level check box then all row level checkbox is checked.i m sending my code here....<script language="javascript" type="text/javascript">        function Check(chk)        {          alert("abc");            if(document.form1.HeaderLevelCheckBox.checked==true)    ...

javascript: check all check box in a perticular row , when i check a checkbox i that perticuler row
Hi Friends,I have a gridview. and I am having checkboxes in all the columns and all the rows. Like it is about selecting subjects.My Problem is when I select a Checkbox in First column of any row, all the checkboxes in that particular row should also be selected.How can I do this... . I have done all checkboxes checked for column, but no idea about row.Please guide.Thanks. Hi, this can be done with the help of jQuery, a great & free javascript library. Take a look at this article: Check All Checkboxes in GridView using JQuery. Grz, Kris.Read my blog. Handy Firefox plugins for web dev...

Check One CheckBox To Check All CheckBoxes
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named CheckAllRows on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the DataGrid & the rest of the CheckBoxes reside within the ItemTemplate of the same TemplateColumn. This is the code (the ID of the CheckBox in the Header...

A checkbox that checks the other checkboxes...
Hi everyone, I'd like to create a checkbox that checks all the checkboxes that are contained in my repeater. Does anyone know how to do this ??? I've tried some javascripts found on the net but nothing works... :'( Please help me ! It's rather urgent ! Thanks for answering ! ^^ Hello... I don't know how to make the page react when you check the box (actually I'm having trouble doing so with a dropdownlist, so if you have any idea :p) but if you add a button that you click after checking the box, you can add in the code behind file [ CheckBox1.Checked = true ] and do so to all t...

Check All Check Box While Check Header CheckBox
 hello...I have two grid on same page...both grid contains header checkbox and item checkbox i want that if use check header checkbox then all item check box checked,i have javascript for this functinality but problem is that when i click on header check box of first grid then checkbox of second grid also checked that i dnt want i want to perform this operation on one grid at one time.i have attache my script also...plz help me....thanks<script type="text/javascript">        function SelectAll(ID)      &nbs...

Set CheckBox.checked = "checked"
I have this code function myButtonClick(RadioButton) {     var e = document.getElementsByName(RadioButton);     var c = document.getElementById("chkBox1");     var f;     for(var i=0; i<e.length; i++)     {            if (e.checked{                 f = e[i[.value;                 break;             }  ...

My Custom checkbox control doesnt give me the right Checked value, when inside another control
Hi there... I have created a custom control based on a checkbox, it works fine when i have my control on an aspx page or in an web user control, but when inside a tabstrip of telerik it always return that it is not checked... Any Ideas? Best regards OleB...

Validation to Check if checkbox is checked
Hi,Which Validation statement should i use to check whether a checkbox is checked?Thanks You can also use CustomValidator for validate if check box is checked or not. Here is the example:   <script> function checkTemp() {             if (document.getElementById("valcheckBoxTemp").checked)                         args.IsValid = true;             else ...

gridview check if checkbox is checked
 I have a column with checkboxes in my gridview, I want to check each row if the checkbox was checked, if yes do something with the data of that row. How do I do that?I added the checkboxes the following way <asp:TemplateField>                                <ItemTemplate>                         &nb...

How to check checkbox is checked or not dynamically....
Hai friends.... I am creating checkbox dynamically............ dim check(100) as checkbox dim cell as new tablecell check(i)=new checkbox() is there any short method to check whether non of the checkbox is checked........... Ambrose... Help me......Winners Never QuitQuitters Never Win You could do this to check if check boxes are checked If CheckBox1.Checked Then    Message.Text &= "CheckBox 1 was checked<br/>"  End If  If CheckBox2.Checked Then    Message.Text &= "CheckBox 2 was checked<br/>"  End ...

leaving the checkbox checked after it is checked
not by default that is. I apologize for double posting, I've been warned that my subject was too vague. Hello everyone, I hope someone can help me with this problem. Here is what I am trying to do: - Job request is entered in Form-A. - When Form-A is submitted, apple.cgi tells the user the form is successfully submitted and at the same time appends the request into an html file (banana.html) that can be seen on the web. - There is a checkbox near each request on Form-A. I want that when the checkbox is checked (meaning the job is done), the job request disappears f...

how to check if checkboxes in datalist is checked?
hi, i have a checkbox in datalist itemtemplate. i need to have a validation that checks if theres atleast 1 checkbox in datalist item that is checked, when button delete is click. Thanks   Here is code to read value of checkbox in datalist control. foreach (DataListItem item in this.dataListName.Items) { //if check box is an html control HtmlInputCheckBox chk = item.Cells[0].FindControl("checkBoxName") as HtmlInputCheckBox; //OR if checkbox is server side control CheckBox chk = item.Cells[0]....

if checkbox is checked , then all the checkboxlist should be checked
i have a checkbox list and a checkbox , i want f the checkbox is checked then all the checkboxes in the checkboxlist should be checked as well.   Please suggest , if there is any way out   Thanksneelu gupta Do u want this to be done on the client side or server side? And are these check boxes server controls or html controls??Shravan Addaypally MCP maybe this thread can help.> penny for a thought...

Web resources about - How do I set a checkbox to checked when another checkbox in a DG row is checked? -

Checkbox - Wikipedia, the free encyclopedia
In computing , a checkbox ( check box , tickbox , or tick box ) is a graphical user interface element ( widget ) that permits the user to make ...

XYplorer adds flat select tool, timestamping, sticky checkbox selection and improves portable device ...
... them a date previously copied to the clipboard. sc_* - *.doc matches both files beginning sc_ and those with a .doc extension. Sticky checkbox ...

Beware of checkbox marketing!
... able to sell the product at all and the company will go out of business. (sometimes in those exact words) These are the two edges of the checkbox ...

Disable Lion’s Resume Checkbox When Shutting Down [Video How-To]
One of the most annoying features in OS X Lion for me has been the little checkbox on the shutdown dialog box that states, "Reopen windows when ...

A Checkbox On Your Tax Return Helped Kill Public Campaign Funding
You already hate tax season, and as you move wearily through the cold calculations of the 1040 form, you come across a familiar checkbox. It’s ...

Google's Clever Plan to Replace CAPTCHA With a Checkbox
CAPTCHAs are an unfortunate side effect of the internet. They're those irritating collection of numbers and letters morphed into some Surrealist ...

Great news: New EEOC checkbox category emerges
"Bow-tie'n white boys"? Hey, I tried to anticipate the next expansion in ethnic categorization yesterday with my proposal for recognition of ...

Checkbox Syndrome: Why We Spend Money on Things We Don't Need
Ever been overwhelmed by the temptation to buy the latest shiny thing because it's got another checkbox in the features column? We call this ...

Magid: Google ditching CAPTCHA for 'I'm not a robot' checkbox
We need better security, but we need to find systems that are hard for bad guys to break but easy for good folks to use. Google is one of the ...

Resources last updated: 12/5/2015 9:22:52 AM