473,320 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Checkbox in Datagrid

I have 2 cols in the datagrid in one col i use check box and another a txtbox
i need to set the readonly property of the textbox based on the checkbox's checked property.Using Asp.net and vb
ex: buythis is the checkbox name and txtqty is the txtbox name.if the buythis is clicked then the txtbox's readonly property is false else true
Jan 13 '07 #1
3 1347
kenobewan
4,871 Expert 4TB
You can either do this in the client-side or server-side. Here is an example that uses client-side that you could adapt:
ASP.NET C# Disable/Enable ListItems

Or a server-side that you could modify to your needs:
Checking All Checkboxes in a Gridview

Hope that this helps.
Jan 13 '07 #2
Thanks for ur reply,
I have used the following code and called it in the oncheckedchange of the checkbox.The problem is that the oncheckedchanged is not triggered is this the correct way?
Sub DetermineSelection(ByVal item As DataGridItem)

Dim selection As CheckBox = _
CType(item.FindControl("buythis"), CheckBox)
Dim qty As New TextBox
qty = CType(item.FindControl("txtqty"), TextBox)

If Not selection Is Nothing Then

If selection.Checked Then
qty.ReadOnly = False
Else
qty.ReadOnly = True
End If
End If

End Sub
Sub doCheck(ByVal sender As Object, ByVal e As EventArgs)

Dim item As DataGridItem

For Each item In dg.Items

DetermineSelection(item)

Next
End Sub
Jan 17 '07 #3
kenobewan
4,871 Expert 4TB
Here is a different example that may be more helpful, with textbox read only and OnCheckedChanged="Check_Change":
TextBox.ReadOnly Property

WrapCheckBox.Checked gives you whether the textbox has been checked. Comment.ReadOnly makes the textbox read only...
Jan 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Just D | last post by:
Hi All, Does anybody know how to write the following code? I have a database table with a few columns including: ID , "Task" , ForceRun . I need to show the DataGrid on the ASPX page with...
2
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
1
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
0
by: mehul | last post by:
CheckBox template always evaluate to False even if checked in a DataGrid hosted inside a TabStrip in ASP.NET Hi, I am trying to develop an ASP.NET application. I am using TabStrip (which is...
7
by: Lars Netzel | last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true I can catch OnChange event on checkbox but how do I then catch what DataGridItemIndex is? Can I use some Event in the...
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
2
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
9
by: Rekha | last post by:
The data is filled in datagrid. I want to know how to add a checkbox column in datagrid? In the runtime, checkbox is checked then instead of checkbox value the (caseID )column value is retained....
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.