473,509 Members | 2,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView RowDataBound -- EditItemTemplate vs. ItemTemplate

K B
Hi, I'm using the following to change a text label in a specific
row/control. This works great until I click the Edit commandfield. then
RowDataBound can't find the Label control because it is now a Textbox.
How do I indicate the using this code ONLY in ItemTemplate mode?

If e.Row.RowType = DataControlRowType.DataRow Then
Dim lbl As Label = CType(e.Row.FindControl("UserName"), Label)
If lbl.Text = "" Then 'should be blank in only one row

Thanks!
KB

*** Sent via Developersdex http://www.developersdex.com ***
Jun 7 '06 #1
1 8747
If e.Row.RowType = DataControlRowType.DataRow And _
e.Row.RowState=DataControlRowState.Alternate Or _
e.Row.RowState=DataControlRowState.Normal Then

--

Riki

"K B" <ka**********@comcast.net> wrote in message
news:OX**************@TK2MSFTNGP02.phx.gbl...
Hi, I'm using the following to change a text label in a specific
row/control. This works great until I click the Edit commandfield. then
RowDataBound can't find the Label control because it is now a Textbox.
How do I indicate the using this code ONLY in ItemTemplate mode?

If e.Row.RowType = DataControlRowType.DataRow Then
Dim lbl As Label = CType(e.Row.FindControl("UserName"), Label)
If lbl.Text = "" Then 'should be blank in only one row

Thanks!
KB

*** Sent via Developersdex http://www.developersdex.com ***

Jun 7 '06 #2

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

Similar topics

6
7065
by: tfsmag | last post by:
I have a Grid that I've set up to have two of the fields use dropdownlists while in edit mode. Now I can bind the data to the dropdownlists just fine. My problem is that the second dropdown depends...
1
14299
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
0
2374
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this...
5
6409
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
0
2465
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1"...
0
1965
by: KeesH | last post by:
Hi, I am quite desperate now because I made a nice webshop with a gridview where the customer is able to update the amount of products (Hostas in my situation) or delete the row. The problem is...
2
3235
by: DC | last post by:
Hi, I am using a GridView to present data in a DataTable, which I store only in ViewState and when the user hits the "OK" button the rows in the DataTable will be used to execute transactions. ...
5
5242
by: Chris | last post by:
Hi, i want to make the forecolor of values into a gridview red but only when they equals 'n'. <asp:GridView ID="GridView1" runat="server" DataKeyNames="hour,place"...
2
1475
by: Danielle | last post by:
All - Thanks in advance for any help you can provide. I've been working with a GridView in Visual Basic for a long time trying to get a list of contacts and to be able to edit and delete the...
0
4162
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
7234
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
7136
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
7412
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...
1
7069
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...
0
5652
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,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
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 ...
1
775
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.