473,750 Members | 2,680 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 2790
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
1284
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
5138
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
2290
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
1837
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
3150
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
976
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
1860
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
2710
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
8838
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9583
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...
0
9396
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
9342
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
8263
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
6081
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
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
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
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.