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

datagrid/ checkbox problem

Hi
I have made a datagrid(cols: emp_code, from_date) where last col contains checkboxes. I am try
to get the application ids for the check boxes that are checked on the click of the button but could not make it.

Here's the code m using...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dgitem As DataGridItem
Dim chk As CheckBox
Dim aid As String
For Each dgitem In applications.Items
chk = dgitem.FindControl("chksel")
If (chk.Checked) Then
aid = CType(dgitem.FindControl("a"), Label).Text
lblsel.Text = aid
Response.Write(aid)
End If
Next
End Sub

n here's d html code:

<form id="Form1" method="post" runat="server">
&nbsp;
<asp:datagrid id="applications" style="Z-INDEX: 101; LEFT: 124px; POSITION: absolute; TOP: 129px" runat="server" AutoGenerateColumns="False" Height="140px" Width="443px">
<Columns>
<asp:boundColumn headertext="emp_code" DataField="emp_code"></asp:boundColumn>
<asp:BoundColumn DataField="start_date" HeaderText="from"></asp:BoundColumn>
<asp:BoundColumn DataField="application_id" HeaderText="appid" Visible="False"></asp:BoundColumn>
<asp:boundColumn headertext="appid" Visible="False"></asp:boundColumn>
<asp:TemplateColumn headertext="aid" Visible="False">
<ItemTemplate>
<asp:Label ID="a" text='<%3databinder.eval(container.dataitem,"aplli cation_id")%>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
<asp:templateColumn headertext="check">
<ItemTemplate>
<asp:CheckBox ID="chksel" Runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:templateColumn>
</Columns>
</asp:datagrid><asp:button id="Button1" style="Z-INDEX: 102; LEFT: 315px; POSITION: absolute; TOP: 341px" runat="server" Height="27px" Width="100px" Text="Button"></asp:button></form>


Pls help me what m doing wrong..............

Regards,
AShima
Dec 22 '06 #1
3 1518
kenobewan
4,871 Expert 4TB
There may be a couple of typos in a line:
Expand|Select|Wrap|Line Numbers
  1. <asp:Label ID="a" text='<%3databinder.eval(container.dataitem,"apllication_id")%>' Runat=server />
Should be
Expand|Select|Wrap|Line Numbers
  1. <%#
and application_id?

Hope that this helps.
Dec 22 '06 #2
There may be a couple of typos in a line:
Expand|Select|Wrap|Line Numbers
  1. <asp:Label ID="a" text='<%3databinder.eval(container.dataitem,"apllication_id")%>' Runat=server />
Should be
Expand|Select|Wrap|Line Numbers
  1. <%#
and application_id?

Hope that this helps.

HI
Sorry 3 instead of # by mistabke. Even if I put # the code doent work. On submission even if the chkbox is checked it gives the value false....Why so?
Regards,
Ashima
Dec 23 '06 #3
kenobewan
4,871 Expert 4TB
Is there an error message? Do you have a line number where it fails?
Dec 23 '06 #4

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

Similar topics

5
by: Jean Carlo | last post by:
Hello guys I`m developing a windows form that contain one Datagrid. In this datagrid I insert a checkBox Column. I need to get all rows where checkbox is checked by user. How do I get this...
1
by: Joe Bloggs | last post by:
I am trying display the contents of a table in a web page, select certain rows from that table and then display the fields that I have selected (now table columns) as text in a Label object....
4
by: Jim Heavey | last post by:
Hello, I am starting to learn how to use the Datagrid and I have a couple of questions. My datagrid as a checkbox in it. It looks like the following in the datagrid... <asp:TemplateColumn...
8
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a...
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...
2
by: Raed Sawalha | last post by:
Dear: I have DataGrid , which its task to (Edit, update, and delete) contents of XML File. the structure of XML like this <Info> <Name></Name> <Age></Age>
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...
1
by: I am Sam | last post by:
I need to be able to delete a record/row from a database table. I am using a DataGrid which is not sending the row index key properly to the event in the codebehind. When I set a break point and...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.