473,499 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing DataSource on GridView RowDataBound

I have a pretty standard bound GridView control with TemplateFields. Now I
need to be able to control the properties of some of the columns based on
values in the recordset that I am NOT displaying. Is there a way to access
the current row of the DataSource in the RowDataBound event?
Nov 8 '07 #1
1 8070
Found it:

Sub gvWarnings_RowDataBound(ByVal sender As Object, ByVal e As
GridViewRowEventArgs) Handles gvWarnings.RowDataBound

Dim drv As Common.DbDataRecord = CType(e.Row.DataItem,
Common.DbDataRecord)
If e.Row.RowType = DataControlRowType.DataRow AndAlso drv IsNot Nothing
AndAlso gvWarnings.EditIndex = -1 Then
If drv("warninglevel") = "HIGH" Then
CType(e.Row.FindControl("btnDelete"), ImageButton).Visible =
False
End If
End If

End Sub
Nov 8 '07 #2

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

Similar topics

0
1035
by: Matthew | last post by:
I have a SQLDataSource object declared in my ASPX page. <asp:SqlDataSource ID="SqlDataSource1" runat="server" etc.. etc.. /> I pipe that query into a GridView, but I also want to populate the...
5
2739
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc"...
3
4588
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
6
11102
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
11223
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
7156
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
9319
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...
4
4121
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview that has 1 row of data. I am trying to set the values of dropdown boxes for each data row based on the data I have binded to the grid but for some reason when I use the...
0
1201
by: damnBoi | last post by:
Good day guys! I'm using c# as my code-behind (ascx.cs) and my environment is Visual Studio 2008. the issue is, i can't get to access labels inside the gridview.. my gridview definition is:...
0
7134
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
7012
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
7180
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
7225
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
6901
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
5479
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,...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.