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

How to make textbox in datagrid appears alternating back-color?

Hi, All
I have an datagrid with alternating color, I also want the back-color
of my textbox in ItemTemplate also appears alternating, how could I do
that?

<asp:datagrid id="dgridEmpHours" width="100%" runat="server"
DataKeyField="employee_key" AutoGenerateColumns="False"
BorderWidth="0" CellPadding="2" cellSpacing="1"
GridLines="None" ShowFooter="True">
<AlternatingItemStyle CssClass="AltBoldtext" />
<ItemStyle CssClass="Boldtext" />
<Columns>
<asp:TemplateColumn SortExpression="employee_Key" HeaderText="employee
Key">
<ItemTemplate>
<asp:Label id="lblEmployeeKey" Visible=False runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.employee_key") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn SortExpression="hours" HeaderText="Hours" >
<ItemTemplate>
<asp:TextBox id=txtHours runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Hours") %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>

Thanks a lot
-Rockdale

Jun 2 '06 #1
1 1555
Nevermind, I can change the back-color in the ItemDataBound event

rockdale wrote:
Hi, All
I have an datagrid with alternating color, I also want the back-color
of my textbox in ItemTemplate also appears alternating, how could I do
that?

<asp:datagrid id="dgridEmpHours" width="100%" runat="server"
DataKeyField="employee_key" AutoGenerateColumns="False"
BorderWidth="0" CellPadding="2" cellSpacing="1"
GridLines="None" ShowFooter="True">
<AlternatingItemStyle CssClass="AltBoldtext" />
<ItemStyle CssClass="Boldtext" />
<Columns>
<asp:TemplateColumn SortExpression="employee_Key" HeaderText="employee
Key">
<ItemTemplate>
<asp:Label id="lblEmployeeKey" Visible=False runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.employee_key") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn SortExpression="hours" HeaderText="Hours" >
<ItemTemplate>
<asp:TextBox id=txtHours runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Hours") %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>

Thanks a lot
-Rockdale


Jun 2 '06 #2

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

Similar topics

0
by: Gidi | last post by:
Hi, I have DataGrid table and TextBox in my form. the table contains names and i use the textBox to enter letters to search specific customer. i want that the user will be able to navigate the...
1
by: Gidi | last post by:
Hi, I have DataGrid table and TextBox in my form. the table contains names and i use the textBox to enter letters to search specific customer. i want that the user will be able to navigate the...
1
by: Johann Blake | last post by:
I have a form with a single textbox control which is bound to a DataRelation in a typed dataset. The textbox displays the name of the product depending on the language selected from a combobox....
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Mark | last post by:
Hi, I have a datagrid with a update link which is used to provide update functionality for a row. When I press the edit (Via EditCommand) button a textbox appears inside the datagrid. My...
0
by: Mike Gorgone | last post by:
Hi All, I'm currently trying to show a datagrid with a parent and child table realtionship. I've got the expansion icon (+) in the row headers and when I click on it I see the link to the child...
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
0
by: Rod | last post by:
I want to be able to access the text in an edit text box which appears when editting a row in a datagrid Now I know that if you have a button column then you can do it like this. Sub...
1
by: tommy.tashjian | last post by:
Hi, I have a datagrid with a textbox column that needs a lookup table. Now, I was going to just use a dropdownlist instead of the textbox, but that won't fly here. So, what I need to know, is it...
12
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid...
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:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.