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

Find Mode in GridView RowDataBound

My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David
Dec 4 '07 #1
3 12220
On Dec 4, 5:15 pm, "David C" <dlch...@lifetimeinc.comwrote:
My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David
Try checking the EditIndex property on your GridView.

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (this.GridView1.EditIndex == -1)
{
//not in edit mode...
}
else
{
//in edit mode
}
}
Dec 5 '07 #2
On 5 çÒÄ, 01:15, "David C" <dlch...@lifetimeinc.comwrote:
My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

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

Regards
Mykola
http://marss.co.ua
Dec 5 '07 #3
Thank you both. I'll keep this somewhere so I can refer to it the next time
my brain goes dead.

David
"Dan Gartner" <dg******@gmail.comwrote in message
news:75**********************************@n20g2000 hsh.googlegroups.com...
On Dec 4, 5:15 pm, "David C" <dlch...@lifetimeinc.comwrote:
>My brain is fried. How can I determine if the row is in edit mode when
processing the RowDataBound event? Thanks.

David

Try checking the EditIndex property on your GridView.

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (this.GridView1.EditIndex == -1)
{
//not in edit mode...
}
else
{
//in edit mode
}
}

Dec 5 '07 #4

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

Similar topics

1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
2
by: Sean | last post by:
I am using a GridView to display and edit rows of data. I am having problems with one of my GridViews that has a Calendar control in it. If the data coming back from the DB doesn't have a date for...
6
by: Kevin Attard | last post by:
I am using a GridView inside a UserControl which has a template column for deleting the rows. Before databinding the gridview i am attaching the RowCommand and RowDataBound event. I am using the...
6
by: AG | last post by:
I have a gridview with a template column containing an imagebutton to delete the row. Under some condition I don't want the row to be deleted, so would like to remove the button. In the...
1
by: =?Utf-8?B?V2VzbGV5IERhdmlzLCBHZW5lcmFsIER5bmFtaWNz | last post by:
I'm moving from years with the datagrid to a new project, .net 2.0, using GridView controls. Per past practice, it is often a lot easier to inject controls (or special formatting) in RowDataBound...
2
by: Tim | last post by:
I'm using a GridView with its DataSource property set to a DataTable. During the RowDataBound event, the first row of the DataTable is reported as a DataControlRowType.Header instead of...
3
by: David C | last post by:
I have a GridView and when the SelectedIndexChange occurs I want to put the value of a BoundField into a TextBox (txtPropertyID) on the page. Below is the code I am using but it is not getting the...
1
by: Ben | last post by:
Hi, The gridview contains a radiobuttonlist with boolean values (true/false) coming from a database. In normal mode, the gridview displays True or False for that field. What i want is to...
0
parshupooja
by: parshupooja | last post by:
Hey All, I have where I want to do some manipulations and show in other column but unable to find their values in RowDatabound event even though I have two records in gridview <asp:GridView...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...
0
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...

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.