473,394 Members | 1,702 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.

Grid View Event Not Working on Alternating Rows

Hello All:

I am working on a ASP.NET GridView, I am not sure to correctly define the
condition so Alternating Rows are fired with in the event. My Code only
works on Item Rows in both Normal and Edit State.

protected void gvUserList_RowDataBound(object sender, GridViewRowEventArgs
e)
{

if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState ==
DataControlRowState.Normal)
{
}

if( e.Row.RowState == DataControlRowState.Edit)
{
}

}

Thanks
Stuart
Dec 28 '05 #1
1 6124
I solved the problem would have been nice if MSFT provided this sample in
the documentation for binding a control (dropdown,checklist,etc) in a Edit
Mode for the GridView

if ((e.Row.RowState == (DataControlRowState.Edit |
DataControlRowState.Alternate)) || (e.Row.RowState ==
DataControlRowState.Edit))
{
/* Edit Mode Code Here (DataControlRowState.Edit) */
}
else if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState ==
DataControlRowState.Normal || e.Row.RowState ==
DataControlRowState.Alternate))
{
/* DataRow Mode Code Here (DataControlRowState.Normal) */
}


"Stuart Shay" <ss***@yahoo.com> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Hello All:

I am working on a ASP.NET GridView, I am not sure to correctly define the
condition so Alternating Rows are fired with in the event. My Code only
works on Item Rows in both Normal and Edit State.

protected void gvUserList_RowDataBound(object sender, GridViewRowEventArgs
e)
{

if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState ==
DataControlRowState.Normal)
{
}

if( e.Row.RowState == DataControlRowState.Edit)
{
}

}

Thanks
Stuart

Dec 29 '05 #2

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

Similar topics

12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
9
by: Max Weebler | last post by:
Hi, I have a datagrid built that has an alternating item style that sets the backcolor and ForeColor of its rows. I have 4 template columns. One of them has a LinkButton embedded in it to...
10
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
1
by: Ed | last post by:
hi everyone, maybe someone can give me a hand here. I am working with vb 2005 and i have a gridview that i am loading data from a recordset. I have the recordset returned from the query and i am...
2
by: Padu | last post by:
I'm looking for a component to make listviews (perhaps grid). I have two requirements for the component for two different situations I want to use it. In the first situation, I need a listview...
3
by: Daniel Manes | last post by:
My DataGridView is set up like this: * Main row background color = white * Alternating row background color = light gray I also have a read-only (non-editable) column I want to show up as solid...
2
by: B. | last post by:
I am able to set the alternate row color using AlternatingRowsDefaultCellStyle. however, if my grid is not fully filled, the alternate row color will not apply for blank rows. How can I fill the...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
2
by: rameshgohil | last post by:
I am using grid view and a button column in it using <itemTemplate> but I am not able to rerive cell value of a selected row from grid view. I have tried the following to methods in Row_command...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...
0
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...

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.