473,700 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sample code for adding checkboxs in a DataGrid

Where I can find sample code for adding checkboxs in a
DataGrid?

Thanks
Jul 19 '05 #1
1 2786
pushkar
10 New Member
Hi John.

Here is the Sample Code for DataGrid with Check BOx.



<asp:datagrid id="sample" runat="server" Width="646px" BorderColor="Sa ddleBrown" BackColor="Whit e"
ForeColor="Sadd leBrown" DataKeyField="t icketno" Height="192px" AllowSorting="T rue" AllowPaging="Tr ue"
BorderStyle="No ne" CellPadding="4" BorderWidth="1p x" AutoGenerateCol umns="False">
<SelectedItemSt yle Font-Bold="True" ForeColor="Whit e" BackColor="#CE5 D5A"></SelectedItemSty le>
<AlternatingIte mStyle BackColor="Whit e"></AlternatingItem Style>
<ItemStyle Font-Size="XX-Small" Font-Names="Verdana" BackColor="#F7F 7DE"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True" ForeColor="Whit e" BackColor="Sadd leBrown"></HeaderStyle>
<FooterStyle BackColor="#CCC C99"></FooterStyle>
<Columns>
<asp:TemplateCo lumn>
<HeaderStyle Width="10%"></HeaderStyle>
<ItemTemplate >
<asp:CheckBox id="chkDel" Runat="server" text='<%# DataBinder.Eval (Container.Data Item,"ticketno" ) %>'>
</asp:CheckBox>
<asp:textbox id=txtPrID Visible="False" Runat="server" text='<%# DataBinder.Eval (Container.Data Item,"ticketno" ) %>'>
</asp:textbox>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Tic ket NO">
<HeaderStyle Width="30%"></HeaderStyle>
<ItemTemplate >
<asp:LinkButt on ID="cmdPrName" Runat="server" CommandName="ti cketno">
<%# DataBinder.Eval (Container.Data Item,"ticketno" ) %>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:BoundColum n DataField="rout eid" SortExpression= "routeID" HeaderText="Rou te ID">
<HeaderStyle Width="40%"></HeaderStyle>
</asp:BoundColumn >
<asp:BoundColum n DataField="rout etime" HeaderText="Rou te Time"></asp:BoundColumn >
<asp:BoundColum n DataField="resv dt" HeaderText="Res ervation Date"></asp:BoundColumn >
<asp:BoundColum n DataField="jour neydt" HeaderText="Jou rney Date"></asp:BoundColumn >
<asp:BoundColum n DataField="rout esrc" HeaderText="Sou rce"></asp:BoundColumn >
<asp:BoundColum n DataField="rout edest" HeaderText="Des tination"></asp:BoundColumn >
<asp:BoundColum n DataField="amou nt" HeaderText="Amo unt"></asp:BoundColumn >
<asp:BoundColum n DataField="tota lseats" HeaderText="Tot al Seat"></asp:BoundColumn >
<asp:BoundColum n DataField="seat nos" HeaderText="Sea t NO"></asp:BoundColumn >
</Columns>
<PagerStyle NextPageText="n ext" Font-Size="Smaller" Font-Names="Verdana" PrevPageText="p rev"
HorizontalAlign ="Right" ForeColor="Whit e" Position="TopAn dBottom" BackColor="Sien na"></PagerStyle>
</asp:datagrid></td>
Jul 24 '06 #2

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

Similar topics

7
1283
by: Oli | last post by:
Hi, I have a form with a textbox... <input type="text" name="textbox1" value="value1" disabled> Obviously that produces a textbox that the user cannot edit. What I want is when the user puts a tick in a checkbox next to the textbox for the textbox to become active.
2
5135
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
0
279
by: John | last post by:
Where I can find sample code for adding checkboxs in a DataGrid? Thanks
5
2282
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a collection object -- say, a dictionary. Populating that collection object with custom objects, say, Person. What I really want to see is how to populate the properties of those Person objects from a datasource: instantiate one Person, fill...
3
1836
by: Grant | last post by:
I need some sample code showing how to manipulate data in my access database using C#. This is what Im trying to do: Dropdownlist with datagrid both bound to datasource. When the drop down list value changes - the datagrid values change accordingly. I managed to get this working by setting the currencymanager to the dropdownlist selectedIndex (which is probably the wrong way to do it, bu the datagrid seems to update its values correctly)...
3
3148
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 expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
0
972
by: Mythran | last post by:
I have seen many examples on the Internet that do the following to format data being bound to a DataGrid....IMO, it's sick.. Public Sub MyGrid_ItemDataBound( ... ) Dim value As String = e.Item.Cells(0).Text.ToLower() If value = "true" e.Item.Cells(0).Text = "Yes" Else e.Item.Cells(0).Text = "No" End If
3
1856
by: George1776 | last post by:
I'm seeing some unexpected behavior in Framework 2.0 / IIS 5.1 in high memory usage situations. The first problem I had is that the default machine.config for Framework 2.0 does not include a memoryLimit entry - Framework 1.0 was set to 60% by default. But even after adding a memoryLimit = 60 to my processModel section all available memory still gets used up and the process dies - the same app under Framework 1.1 returns the requested...
17
2704
by: shivasusan | last post by:
Hi! In my program, I have multiple check boxs.(more the 10) But i give rights to select 2 check boxs, If i select more then 2 check boxs, I want to display alert message. Please any one post me modle program. Please very very urgent.... any only help me... By Susan.
0
8714
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
9203
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8958
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
7797
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...
1
6557
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5897
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
4396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2021
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.