473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help needed on using buttoncolumn in datagrid

Hi all,
I am using a datagrid to show values from a SQL table.
My problem is, I want to show the details of the each row when the user clicks the 'View details' buttoncolumn.
I am able to fire a event when the user clicks the button column

here is my html for the datagrid
************************************************** ************************************
<Columns>
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="Title" DataNavigateUrlFormatString="SelectedTitle.aspx?ti tle={0}"
DataTextField="Title" SortExpression="Title" HeaderText="TITLE"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="Author" HeaderText="AUTHOR"></asp:BoundColumn>
<asp:BoundColumn DataField="Year" HeaderText="YEAR">
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:ButtonColumn ButtonType="LinkButton" text="View Details" CommandName="select"></asp:ButtonColumn>
</Columns>
************************************************** *************************************
when i try to capture the column values and write it to a label, it returns empty string to the label
here is the code that i am using,

Dim buttonColumn As TableCell = e.Item.Cells(0)
Dim buttonColText As String = buttonColumn.Text
Label1.Text = buttonColText
how should i go about doing that. any help is appreciated.
Thank you

--------------------------------
From: Lenin Sakthees

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>jnkENdEaQ0+N3CV3kc2qqg==</Id>
Nov 19 '05 #1
1 3386
Hi Lenin,

Actually the first column in the datagrid is a hyperlink
column. So you may use

e.Item.Cells(1)

HTH

Elton Wang
el********@hotmail.com

-----Original Message-----
Hi all,
I am using a datagrid to show values from a SQL table.
My problem is, I want to show the details of the each row when the user clicks the 'View details' buttoncolumn.I am able to fire a event when the user clicks the button column
here is my html for the datagrid
************************************************* ********* ****************************<Columns>
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="Title"
DataNavigateUrlFormatString="SelectedTitle.aspx?ti tle={0}" DataTextField="Title" SortExpression="Title"
HeaderText="TITLE"></asp:HyperLinkColumn> <asp:BoundColumn DataField="Author" HeaderText="AUTHOR"></asp:BoundColumn> <asp:BoundColumn DataField="Year" HeaderText="YEAR"> <ItemStyle HorizontalAlign="Left"></ItemStyle> </asp:BoundColumn>
<asp:ButtonColumn ButtonType="LinkButton" text="View Details"
CommandName="select"></asp:ButtonColumn> </Columns>
************************************************* ********* *****************************when i try to capture the column values and write it to a label, it returns empty string to the labelhere is the code that i am using,

Dim buttonColumn As TableCell = e.Item.Cells(0)
Dim buttonColText As String = buttonColumn.Text
Label1.Text = buttonColText
how should i go about doing that. any help is appreciated.
Thank you

--------------------------------
From: Lenin Sakthees

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>jnkENdEaQ0+N3CV3kc2qqg==</Id>
.

Nov 19 '05 #2

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

Similar topics

3
by: John | last post by:
The ItemCommand event not getting fired when I add both a BoundColumn and a ButtonColumn to a datagrid. When I add a ButtonColumn by itself, everything works fine, but as soon as I add a...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
6
by: z. f. | last post by:
Hi, i have a datagrid with a delete button for each row in the grid. when the delete button is clicked i need to ask the user in a "confirm" message box if he's sure he wants to delete. the...
8
by: Alejandro Penate-Diaz | last post by:
I have a datagrid inside a table and I want to fix both (table and databrid) width to 700, but when the content of datagrid is too large the width increases automatically sometimes and sometimes...
2
by: Raghu Raman | last post by:
Hi, In my asp .net page am using many controls and a grid.i populate many html controls innside the grid dynamically .if i click the grid ,it wll go to other page using onclick client side...
1
by: Ben | last post by:
Hi there, I would like to change the text of the ButtonColumn after datagrid binding, depending on the value of a certain field. (eg. Text="Details" for case 1, Text="others' for case 2) Is...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
9
by: rn5a | last post by:
A DataGrid is populated with the records existing in a database. Each of the row in this DataGrid has a ButtonColumn. Assume that the DataGrid displays 10 records (i.e. 10 DataGridItems/rows). Each...
2
CroCrew
by: CroCrew | last post by:
Hello all, First off I would like to thank anyone that helps me out with this problem that I have. Ok, the environment I am working in is ASP.net with the code behind done in VB. I have a...
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
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
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,...
1
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
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
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.