473,769 Members | 5,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 onCheckedChange d 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:TemplateCo lumn HeaderImageUrl= "../Images/Tick.gif">
<HeaderStyle HorizontalAlign ="Center" Height="20px" Width="10px"
CssClass="dgHea der" VerticalAlign=" Middle"></HeaderStyle>
<ItemStyle HorizontalAlign ="Center" Width="10px"
VerticalAlign=" Middle"></ItemStyle>
<ItemTemplate >
<asp:CheckBox ID="chkSelectio n" Runat="server" AutoPostBack="T rue"
OnCheckedChange d="myFunction"> </asp:CheckBox>
</ItemTemplate>
</asp:TemplateCol umn>

public void myFunction(obje ct sender, System.EventArg s e)
{
this.lbldatagri drow.Text = e.Item.Cells[0].Text;
}
Build Error: -
'System.EventAr gs' does not contain a definition for 'Item'

Any ideas anyone
Nov 22 '05 #1
0 856

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

Similar topics

0
911
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. 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...
0
2620
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 the dataset that I would store the string 'true' and 'false' rather than a numeric value. I did this because I thought it would make it easier to actually set the value in the checkbox. Anyway, I bind the dataset to the datagrid. In my HTML...
1
4498
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. 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...
2
2063
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 the dataset that I would store the string 'true' and 'false' rather than a numeric value. I did this because I thought it would make it easier to actually set the value in the checkbox. Anyway, I bind the dataset to the datagrid. In my HTML...
7
2277
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 Datagrid that will fire off when the Checkbox is changed? regards /Lars
10
2446
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 control in a datagrid? Now I have a Select column but the problem is that the user needs to select more than one record and send them all to print, instead of being one by one like is now with the Select column. Another question, is it possible to...
2
5457
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 values in the underlying datatable column, and resets the binding to the datagrid. The only problem is that, when the user pages back and forth in the datagrid, their selection is overwritten with the default selection in page load. So, if the...
9
1595
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. I know there is a lot of article on datagrid with checkbox but nothing helped me . Can anyone help me how to proceed ? Thanks
6
2966
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 Page_Load(Object sender, EventArgs e) { ItemsGrid.DataSource = CreateDataSource(); void Item_Bound(Object sender, DataGridItemEventArgs e) {
0
1415
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 CheckedChanged event invokes a sub named 'CheckChanged'. The ID of the CheckBox in the DataGrid is 'chk'. This is the sub 'CheckChanged': Sub CheckChanged(ByVal obj As Object, ByVal ea As EventArgs) Dim cbox As CheckBox Dim dgiRow As DataGridItem
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.