473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Datagrid wire SelectedIndexChanged event from linkbutton

I have a datagrid with some dynamically generated columns containing
linkButtons. How can I wire these events to fire the
datagrid_SelectedIndexChanged?

When clicking a template column defined in the IDE it works fine, the
event fires. However, anything that I add in code does not fire this
event?

Any idea?

Thanks

Alex

Nov 19 '05 #1
2 1768
I should note that generally speaking, adding controls to a datagrid like you
are doing is not a good idea. Your code is generally much cleaner if you use
template columns. I have not checked this code, but this should work:
lkButton.Click += new EventHandler(DataGrid1_SelectedIndexChanged);

where lkButton is your Button and DataGrid1_SelectedIndexChanged is your
datagrid selected index changed method. It is important to note that the
sender object will be a LinkButton and not a DataGrid row or anything like
that.

Hope that helps!

Jason Lind

"Alex" wrote:
I have a datagrid with some dynamically generated columns containing
linkButtons. How can I wire these events to fire the
datagrid_SelectedIndexChanged?

When clicking a template column defined in the IDE it works fine, the
event fires. However, anything that I add in code does not fire this
event?

Any idea?

Thanks

Alex

Nov 19 '05 #2
Jason,

Thanks for the reply. I am using a Template column in code to add the
columns. How can I have the button inside my template column fire the
datagrid SelectedIndexChanged?

Thanks

Alex

Nov 19 '05 #3

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

Similar topics

2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
0
by: tafpin | last post by:
I have an application with a datagrid. In the IDE I have 2 template columns. The first has an image button and the second contains a link button. According to the results that I get back I must...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
tracyyun
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...
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,...

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.