![]() |
|
|
|||||||
![]() |
ASP Net - Grid View Event Not Working on Alternating Rows |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Posts: n/a
|
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 |
|
|
|
#2 |
|
Posts: n/a
|
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" <> wrote in message news:OdEC$... > 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 > > |
|
|
|
#3 |
|
Posts: n/a
|
Hi.
All I can say is thank you and I totally agree. I have searched the web for examples of how to achive this, but yours is the ownly article I have found. Many thanks. Neil From http://www.developmentnow.com/g/8_20...nating-Rows.ht Posted via DevelopmentNow.com Group http://www.developmentnow.com |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TRADING FEMALE CELEB INTERVIEWS ON DVD | stu | DVD Video | 1 | 05-26-2008 08:39 AM |
| asp.net : custom code to delete data from Grid view (Database) | sara_23apr | Software | 1 | 06-19-2007 12:08 PM |
| Grid view in link using C# | yogarajan | Software | 0 | 05-05-2007 07:28 AM |