473,387 Members | 1,693 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,387 software developers and data experts.

Writing code for a checkbox in a datagrid

I have the following asp:checkbox as a row in my datagrid. and im trying to
write code on the onCheckedChanged event of it. The code im trying to write
is incorrect as im getting build errors. What im trying to do is populate a
label on my aspx page with the contents of the row in the database which I
have checked. When I uncheck the checkbox I want the label to be set to
blank so as it can be populated again when another checkbox in the datagrid
is ticked. The html for the checkbox is below along with the code-behind
page. Can someone tell me what i've done wrong and how I can fix this.
Thanks for any help anyone can give.

<asp:TemplateColumn HeaderImageUrl="../Images/Tick.gif">
<HeaderStyle HorizontalAlign="Center" Height="20px" Width="10px"
CssClass="dgHeader" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="10px"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Runat="server" AutoPostBack="True"
OnCheckedChanged="myFunction"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>

public void myFunction(object sender, System.EventArgs e)
{
this.lbldatagridrow.Text = e.Item.Cells[0].Text;
}
Build Error: -
'System.EventArgs' does not contain a definition for 'Item'

Any ideas anyone
Nov 22 '05 #1
0 843

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stephen | last post by:
I have the following asp:checkbox as a row in my datagrid. and im trying to write code on the onCheckedChanged event of it. The code im trying to write is incorrect as im getting build errors....
0
by: microsoft.public.dotnet.languages.csharp | last post by:
I have a numeric Oracle field which stores -1 for true and 0 for false. I am trying to populate a checkbox in a datagrid. In my SQL statement, I used the Decode function so that when it populates...
1
by: Stephen | last post by:
I have the following asp:checkbox as a row in my datagrid. and im trying to write code on the onCheckedChanged event of it. The code im trying to write is incorrect as im getting build errors....
2
by: Marty | last post by:
I have a numeric Oracle field which stores -1 for true and 0 for false. I am trying to populate a checkbox in a datagrid. In my SQL statement, I used the Decode function so that when it populates...
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: Andre Ranieri | last post by:
Hi folks, I have a datagrid which contains a template item checkbox column. I've included a checkbox as a HeaderTemplate item which fires a server-side function to check or uncheck all the...
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....
6
by: hazz | last post by:
ICollection CreateDataSource() { dt.Columns.Add(new DataColumn("ReportInclude", typeof(Boolean))); for (int i=0; i<=10; i++) { dr = dt.NewRow(); dr = 0; dt.Rows.Add(dr); } void...
0
by: rn5a | last post by:
I have a DataGrid where in the first column of each row is a CheckBox (the CheckBoxes reside in the TemplateColumn of the DataGrid). The CheckBox's AutoPostBack property is set to True & its...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.