473,789 Members | 2,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView. Get value.

Hello,

I need to get the value of a Gridfiew field named "Channel" which is
the first column of the Gridview.

I want to use that value to build the ToolTip of an image. How can I do
this?

Here is my code:

Private Sub gvRSSChannels_R owDataBound(ByV al src As Object, ByVal e
As GridViewRowEven tArgs) Handles gvRSSChannels.R owDataBound

' Bind row elements
If e.Row.RowType = DataControlRowT ype.DataRow Then

' Define row view
Dim rvRSSChannels As DataRowView = CType(e.Row.Dat aItem,
DataRowView)

' Define channel data column
Dim channel As String = rvRSSChannels(" Channel").ToStr ing

' Define cells collection
Dim tccRSSChannels As TableCellCollec tion = e.Row.Cells

' Define hfIcon hyperlink
Dim hfIcon As HyperLink =
CType(tccRSSCha nnels(tccRSSCha nnels.Count - 3).Controls(0), HyperLink)
hfIcon.ImageUrl =
Me.GetLocalReso urceObject("hfI con.ImageUrl"). ToString()
hfIcon.ToolTip = Me.GetGlobalRes ourceObject("RS S", "{0}_Title" )
' ******
End If

End Sub

See, where I have *****: "{0}_Title"
I thought {0} would work but it is not working.

Could somebody tell me why?

Thanks,
Miguel

Oct 7 '06 #1
2 2179
''' <summary>
''' This event is fired immediately after ItemCreated event if item
''' supports data binding.
''' Here we are accessing the Datagrid Items (rows) and changing the
''' Tooltip of first columns inside that row.
''' </summary>
Public Sub grid_OnItemData Bound(sender As Object, e As DataGridItemEve ntArgs)
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem Then
Dim drv As DataRowView = CType(e.Item.Da taItem, DataRowView)
Dim webCtrl As WebControl = CType(e.Item.Ce lls(0), WebControl)
webCtrl.ToolTip = "Tooltip value"
End If
End Sub 'grid_OnItemDat aBound

"shapper" <md*****@gmail. comwrote in message news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello,

I need to get the value of a Gridfiew field named "Channel" which is
the first column of the Gridview.

I want to use that value to build the ToolTip of an image. How can I do
this?

Here is my code:

Private Sub gvRSSChannels_R owDataBound(ByV al src As Object, ByVal e
As GridViewRowEven tArgs) Handles gvRSSChannels.R owDataBound

' Bind row elements
If e.Row.RowType = DataControlRowT ype.DataRow Then

' Define row view
Dim rvRSSChannels As DataRowView = CType(e.Row.Dat aItem,
DataRowView)

' Define channel data column
Dim channel As String = rvRSSChannels(" Channel").ToStr ing

' Define cells collection
Dim tccRSSChannels As TableCellCollec tion = e.Row.Cells

' Define hfIcon hyperlink
Dim hfIcon As HyperLink =
CType(tccRSSCha nnels(tccRSSCha nnels.Count - 3).Controls(0), HyperLink)
hfIcon.ImageUrl =
Me.GetLocalReso urceObject("hfI con.ImageUrl"). ToString()
hfIcon.ToolTip = Me.GetGlobalRes ourceObject("RS S", "{0}_Title" )
' ******
End If

End Sub

See, where I have *****: "{0}_Title"
I thought {0} would work but it is not working.

Could somebody tell me why?

Thanks,
Miguel

Oct 7 '06 #2
Hi,

But why not do this in RowDataBound?
If I set there my ImageUrl can't I access the value of column 0 and use
it to create the tooltip?

Thanks,
Miguel

Jon Paal wrote:
''' <summary>
''' This event is fired immediately after ItemCreated event if item
''' supports data binding.
''' Here we are accessing the Datagrid Items (rows) and changing the
''' Tooltip of first columns inside that row.
''' </summary>
Public Sub grid_OnItemData Bound(sender As Object, e As DataGridItemEve ntArgs)
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem Then
Dim drv As DataRowView = CType(e.Item.Da taItem, DataRowView)
Dim webCtrl As WebControl = CType(e.Item.Ce lls(0), WebControl)
webCtrl.ToolTip = "Tooltip value"
End If
End Sub 'grid_OnItemDat aBound

"shapper" <md*****@gmail. comwrote in message news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello,

I need to get the value of a Gridfiew field named "Channel" which is
the first column of the Gridview.

I want to use that value to build the ToolTip of an image. How can I do
this?

Here is my code:

Private Sub gvRSSChannels_R owDataBound(ByV al src As Object, ByVal e
As GridViewRowEven tArgs) Handles gvRSSChannels.R owDataBound

' Bind row elements
If e.Row.RowType = DataControlRowT ype.DataRow Then

' Define row view
Dim rvRSSChannels As DataRowView = CType(e.Row.Dat aItem,
DataRowView)

' Define channel data column
Dim channel As String = rvRSSChannels(" Channel").ToStr ing

' Define cells collection
Dim tccRSSChannels As TableCellCollec tion = e.Row.Cells

' Define hfIcon hyperlink
Dim hfIcon As HyperLink =
CType(tccRSSCha nnels(tccRSSCha nnels.Count - 3).Controls(0), HyperLink)
hfIcon.ImageUrl =
Me.GetLocalReso urceObject("hfI con.ImageUrl"). ToString()
hfIcon.ToolTip = Me.GetGlobalRes ourceObject("RS S", "{0}_Title" )
' ******
End If

End Sub

See, where I have *****: "{0}_Title"
I thought {0} would work but it is not working.

Could somebody tell me why?

Thanks,
Miguel
Oct 8 '06 #3

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

Similar topics

1
8317
by: Mark Richards | last post by:
I posted this earlier, and got no response. Basically I need to be able to grab a value from one of the fields in a gridView to populate a dropdown in another column of the gridview: I have a gridView that has 2 templated columns that contain drop-down lists. The first drop down list uses a value off of a formview on the same page for filtering. The 2nd drop-down is supposed to use the value off the first drop-down for it's...
5
4840
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
5
6454
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 dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. If I point the ODS at the child table, the GridView will bind to the "normal" select and I end up...
0
8063
by: ssims | last post by:
I've got a GridView that's sorted by a stored procedure with ROW_NUMBER: PROCEDURE dbo.GetCalendarsByStatusIDPaged ( @startRowIndex int, @maximumRows int, @statusID int ) AS
5
25354
by: maurban | last post by:
Hi there experts, I have a gridview with a couple textboxes and a dropdownlist. I'm trying to insert a default value into my database driven dropdownlist. I'm doing this in the rowdatabound event. My problem is that my code only works for the very first row in the gridview. For the first row, when I press "edit", my gridview goes to edit mode, my textboxes and dropdownlist populate. Further, my dropdownlist has the "Select" I forced in...
7
17320
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work either! Does anyone know how can I make this work? Thanks in advance!
2
2117
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent back the proper number of rows. The only thing different I am doing is to display the number of rows returned in the footer of the gridview. The Bindgrid is as follows: Sub BindGrid() Session("reportlevel") = Session("availabilityrptlevel")
0
1383
parshupooja
by: parshupooja | last post by:
Hi all, I need help. I am using asp.net C# . I have binded gridview with 5 columns. I have Dropdownlist in 4 columns Morning in, morning out, afternoon in and afternoon out and label in 5 column named as totalwhere i want to show calculation(morningout-morningin+afternoonout-afternoonin) but whenever i try to run this i get error in bolded section that "input string is not in correct format". However I have acheived this calculation on...
3
2185
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I have a gridview that uses a sqldatasource. The rows of the gridview are editable. When the gridview is in edit mode, one of the columns is a dropdown. In testing the editing, I deleted the dropdown entry from one of the rows. So, when the gridview comes up, it shows nothing in the column where I deleted it. Then when I select to edit that same row, I get an error because I cannot select the value for the dropdown for a non-existing value....
3
5246
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use DataTable, I am using List of Objects. Here's one example: http://ryanolshan.com/technology/gridview-without-datasourcecontrol-datasource/
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
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,...
1
7529
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 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...
0
5418
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...
1
4093
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
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.