I've searched, reviewed, and attempted dozens of code ideas on the subject. I
can't seem to get something that seems so simple to work. To highlight a row
in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateCo lumn HeaderText="CA Date Req"
HeaderStyle-CssClass="gridq text" ItemStyle-CssClass="gridt ext">
<ItemTemplate >
<asp:Label ID="lblcadatere q" CssClass="gridt ext" width="75" Runat="server"
Text='<%# DataBinder.Eval (Container.Data Item, "Concern_DCADat e", "{0:d}") %>'
Visible="True">
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns,
but I need values from checkbox (#3) and Label (#4). I've tried, etc.:
CType(E.Item.Fi ndControl("lblc adatereq"), Label).Text
What is strange is that when I run (Onitemcreated) :
Response.Write( "value = " & e.Item.Cells(4) .Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom
row). I get:
#1 value = "Title of Header"
#2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using:
e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem
but still no values from grid for rows 2 and 3???? 4 2177
It is not clear from the message what is your immediate problem. You can't
get a value of a bound column? Bound columns get value in ItemDataBound
event. Also you can use PreRender event in which the grid is already fully
populated with all values.
Eliyahu
"Chris" <Ch***@discussi ons.microsoft.c om> wrote in message
news:36******** *************** ***********@mic rosoft.com... I've searched, reviewed, and attempted dozens of code ideas on the
subject. I can't seem to get something that seems so simple to work. To highlight a
row in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateCo lumn HeaderText="CA Date Req" HeaderStyle-CssClass="gridq text" ItemStyle-CssClass="gridt ext"> <ItemTemplate > <asp:Label ID="lblcadatere q" CssClass="gridt ext" width="75" Runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "Concern_DCADat e", "{0:d}")
%>' Visible="True"> </asp:Label> </ItemTemplate> </asp:TemplateCol umn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns, but I need values from checkbox (#3) and Label (#4). I've tried, etc.: CType(E.Item.Fi ndControl("lblc adatereq"), Label).Text
What is strange is that when I run (Onitemcreated) :
Response.Write( "value = " & e.Item.Cells(4) .Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom row). I get: #1 value = "Title of Header" #2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using: e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem but still no values from grid for rows 2 and 3????
I would say that you were on the right track with the OnItemDataBound Event.
This fires before the binding so basically you can grab values from your
datsource and do some conditional logic. OnItemCreated Event also comes to
mind; but somehow I don't think this would give you a solution for this.
They got to have code sames for this out there.
"Chris" <Ch***@discussi ons.microsoft.c om> wrote in message
news:36******** *************** ***********@mic rosoft.com... I've searched, reviewed, and attempted dozens of code ideas on the subject. I can't seem to get something that seems so simple to work. To highlight a row in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateCo lumn HeaderText="CA Date Req" HeaderStyle-CssClass="gridq text" ItemStyle-CssClass="gridt ext"> <ItemTemplate > <asp:Label ID="lblcadatere q" CssClass="gridt ext" width="75" Runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "Concern_DCADat e", "{0:d}") %>' Visible="True"> </asp:Label> </ItemTemplate> </asp:TemplateCol umn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns, but I need values from checkbox (#3) and Label (#4). I've tried, etc.: CType(E.Item.Fi ndControl("lblc adatereq"), Label).Text
What is strange is that when I run (Onitemcreated) :
Response.Write( "value = " & e.Item.Cells(4) .Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom row). I get: #1 value = "Title of Header" #2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using: e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem but still no values from grid for rows 2 and 3????
I would say that you were on the right track with the OnItemDataBound Event.
This fires before the binding so basically you can grab values from your
datsource and do some conditional logic. OnItemCreated Event also comes to
mind; but somehow I don't think this would give you a solution for this.
They got to have code sames for this out there.
"Chris" <Ch***@discussi ons.microsoft.c om> wrote in message
news:36******** *************** ***********@mic rosoft.com... I've searched, reviewed, and attempted dozens of code ideas on the subject. I can't seem to get something that seems so simple to work. To highlight a row in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateCo lumn HeaderText="CA Date Req" HeaderStyle-CssClass="gridq text" ItemStyle-CssClass="gridt ext"> <ItemTemplate > <asp:Label ID="lblcadatere q" CssClass="gridt ext" width="75" Runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "Concern_DCADat e", "{0:d}") %>' Visible="True"> </asp:Label> </ItemTemplate> </asp:TemplateCol umn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns, but I need values from checkbox (#3) and Label (#4). I've tried, etc.: CType(E.Item.Fi ndControl("lblc adatereq"), Label).Text
What is strange is that when I run (Onitemcreated) :
Response.Write( "value = " & e.Item.Cells(4) .Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom row). I get: #1 value = "Title of Header" #2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using: e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem but still no values from grid for rows 2 and 3????
got it! Was using Itemcreated, switch to ItemDataBound and used:
Dim careq As Boolean = CType(e.Item.Ce lls(3).FindCont rol("ckcareq"),
CheckBox).Check ed
Dim cadate As Date =
CType(e.Item.Ce lls(4).FindCont rol("lblcadater eq"), Label).Text
got the values, thanx.!
"Eliyahu Goldin" wrote: It is not clear from the message what is your immediate problem. You can't get a value of a bound column? Bound columns get value in ItemDataBound event. Also you can use PreRender event in which the grid is already fully populated with all values.
Eliyahu
"Chris" <Ch***@discussi ons.microsoft.c om> wrote in message news:36******** *************** ***********@mic rosoft.com... I've searched, reviewed, and attempted dozens of code ideas on the subject. I can't seem to get something that seems so simple to work. To highlight a row in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateCo lumn HeaderText="CA Date Req" HeaderStyle-CssClass="gridq text" ItemStyle-CssClass="gridt ext"> <ItemTemplate > <asp:Label ID="lblcadatere q" CssClass="gridt ext" width="75" Runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "Concern_DCADat e", "{0:d}") %>' Visible="True"> </asp:Label> </ItemTemplate> </asp:TemplateCol umn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns, but I need values from checkbox (#3) and Label (#4). I've tried, etc.: CType(E.Item.Fi ndControl("lblc adatereq"), Label).Text
What is strange is that when I run (Onitemcreated) :
Response.Write( "value = " & e.Item.Cells(4) .Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom row). I get: #1 value = "Title of Header" #2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using: e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem but still no values from grid for rows 2 and 3???? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gerg |
last post by:
The datagrid has a tablestyle applied to it, and there
are DataGridTextBoxColumn and each DataGridTextBoxColumn
has an array of DataGridTextBox objects.
Private Sub highlight(ByVal str As String)
Dim myTextBoxcolumn As DataGridTextBoxColumn
Dim myTextBox As DataGridTextBox
'loop through the cells of the datagrid, searching
for the string
|
by: Andrea Trevisan |
last post by:
That's a revival of a known thing I suppose.I hope it's useful.
My problem was:
I want to have a DataGrid with two Template columns: first with
TextBox,second with Button.I want to fire an event from
button and I want to have a reference to TextBox to make use of it.The
most difficult was the reference to TextBox.
This sample is taken from MCAD/MCSD Exam 70-305/70-315 of Microsoft
Press.This book is much more exhaustive than the brief...
|
by: mike |
last post by:
I'm trying to highlight a specific row in a datagrid who's contition matches
..text = "Dawn"
i've been playing with the code below without much luck, is there a foreach
loop i could do, like
(
foreach(datarows in datagrid)
check if the first cell in the row contains Dawn
if so highlight the row.
)
|
by: Richard Roche |
last post by:
Is it possible to use a drop combo instead of a text box
when using the EditCommand in the Datagrid? Many table
columns are bound to 'lookup' tables, user's don't care
about the foreign keys, they want the text value. Any
advice, samples or places to read are appreciated.
Thanks.
|
by: LU |
last post by:
A)I build a datagrid based on a calendar date selection.
B)When user clicks a button column on the datagrid I want to highlight this
row. I use the code below to highlight the row.
***** CODE TO HIGHLIGHT ROW
Sub Datagrid_ItemCommand(ByVal s As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "ViewUnitRequest" Then
e.Item.BackColor = System.Drawing.Color.LightGray
| |
by: Geraldine Hobley |
last post by:
Hello
I have a datagrid, called MyDataGrid and I wish to put the focus on a particular cell in order that the user to highlight the fact that the user needs to enter a value in this cell, e.g. I put the message up "Please enter an order number" I then wish to highlight the column MyDataGrid(0,1), but I can't find out how to do this
Many thanx in advance
Geri
|
by: Savvas |
last post by:
Hi,
I am using VB.Net 2005 for a windows application. The application was
actually upgraded from vb.net 2003.
I have a search field which is used as a parameter to search all
datagrid columns. According to this parameter, the dataset and datagrid
shows only the columns where the search parameter applies. The code is
|
by: rn5a |
last post by:
How to highlight a row in a DataGrid that has just been edited?
EditItemStyle-BackColor will highlight a row when the DataGrid (& a
row) is in the editable mode. I want to highlight the row immediately
after the row has been edited (i.e. when the DataGrid reverts back to
the uneditable mode) so that users can easily notice which row they
have edited just now.
|
by: kannabiran |
last post by:
Hi Guys,
Im using c# asp.net,i had used datagrid to display the record from the database,in the datagrid i had used template column as textbox now i need to highlight the row onmouseover using javascript and also specify in server side how to hande this? help me
rgrds
Kanna...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
| |