473,473 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Two Select LinkButton's in DataGrid

I have to LinkButtons in a DataGrid, and each of them has a Command="Select"
attribute set up.
When either of hte LinkButton's is clicked, I want the proper row in the
DataGrid to be selected, but I then want to do a different operation
depending on which LinkButton was clicked.

Here's some of the Html out of my DataGrid

<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkViewEdit" Runat="server" CommandName="Select"
CausesValidation="false" Text="View"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<asp:LinkButton ID="lnkStatus" Runat="server" CommandName="Select"
CausesValidation="False" Text='<%# DataBinder.Eval(Container,
"DataItem.Status")%>' OnClick="lnkStatus_OnClick"/>
</ItemTemplate>
</asp:TemplateColumn>

In my dgIssues_OnSelectedIndexChanged DataGrid event, I can't see a way to
figure out a way to find out which LinkButton raised the event.

I tried adding an OnClick event to my second LinkButton, lnkStatus. When
debugging I realized that this event is called BEFORE the
dgIssues_OnSelectedIndexChanged event. I wanted to do the custom operation
if the second LinkButton was clicked AFTER the
dgIssues_OnSelectedIndexChanged event was called.

Thanks in advance for any help or tips.

Nov 19 '05 #1
2 2038
What about specifying a CommandArgument and then checking the
e.CommandArgument property?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"George Durzi" <gd****@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
I have to LinkButtons in a DataGrid, and each of them has a
Command="Select" attribute set up.
When either of hte LinkButton's is clicked, I want the proper row in the
DataGrid to be selected, but I then want to do a different operation
depending on which LinkButton was clicked.

Here's some of the Html out of my DataGrid

<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkViewEdit" Runat="server"
CommandName="Select" CausesValidation="false" Text="View"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<asp:LinkButton ID="lnkStatus" Runat="server" CommandName="Select"
CausesValidation="False" Text='<%# DataBinder.Eval(Container,
"DataItem.Status")%>' OnClick="lnkStatus_OnClick"/>
</ItemTemplate>
</asp:TemplateColumn>

In my dgIssues_OnSelectedIndexChanged DataGrid event, I can't see a way to
figure out a way to find out which LinkButton raised the event.

I tried adding an OnClick event to my second LinkButton, lnkStatus. When
debugging I realized that this event is called BEFORE the
dgIssues_OnSelectedIndexChanged event. I wanted to do the custom operation
if the second LinkButton was clicked AFTER the
dgIssues_OnSelectedIndexChanged event was called.

Thanks in advance for any help or tips.

Nov 19 '05 #2
What about specifying a CommandArgument and then checking the
e.CommandArgument property?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"George Durzi" <gd****@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
I have to LinkButtons in a DataGrid, and each of them has a
Command="Select" attribute set up.
When either of hte LinkButton's is clicked, I want the proper row in the
DataGrid to be selected, but I then want to do a different operation
depending on which LinkButton was clicked.

Here's some of the Html out of my DataGrid

<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkViewEdit" Runat="server"
CommandName="Select" CausesValidation="false" Text="View"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<asp:LinkButton ID="lnkStatus" Runat="server" CommandName="Select"
CausesValidation="False" Text='<%# DataBinder.Eval(Container,
"DataItem.Status")%>' OnClick="lnkStatus_OnClick"/>
</ItemTemplate>
</asp:TemplateColumn>

In my dgIssues_OnSelectedIndexChanged DataGrid event, I can't see a way to
figure out a way to find out which LinkButton raised the event.

I tried adding an OnClick event to my second LinkButton, lnkStatus. When
debugging I realized that this event is called BEFORE the
dgIssues_OnSelectedIndexChanged event. I wanted to do the custom operation
if the second LinkButton was clicked AFTER the
dgIssues_OnSelectedIndexChanged event was called.

Thanks in advance for any help or tips.

Nov 19 '05 #3

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

Similar topics

4
by: Calvin Lai | last post by:
Hi all, Does anyone know how I could add a confirm (client side) feature on those Delete Linkbutton in DataGrid? Thanks,
0
by: Solomon Shaffer | last post by:
This is very interesting - and odd. I have a number of LinkButtons that are created in a custom data grid that I created. The purpose of the LinkButtons is to provide alphabetical filtering...
1
by: Bazza Formez | last post by:
Hi, The intended functionality is as follows : I want the user to be able to click on the LinkButton for an individual row in a datagrid, server side sub grabs id for item selected, stores in...
1
by: Danny Ni | last post by:
Hi, I have a LinkButton inside a datagrid, when this LinkButton is clicked, the program deleete a record in database. I would like to add a confirmation on client side. I know I can do...
0
by: George Durzi | last post by:
I have to LinkButtons in a DataGrid, and each of them has a Command="Select" attribute set up. When either of hte LinkButton's is clicked, I want the proper row in the DataGrid to be selected, but...
3
by: CharlesA | last post by:
Hi folks, I really need help with the following scenario, I'm going to describe as well as a I can what the setup is and what I can't understand I'm using the framework 1.1 using ASP.net with...
7
by: Alex Maghen | last post by:
I have a DataGrid control with a LinkButton command column that deletes the row. What I want to do is set it up so that there's a client-side Confirm alert BEFORE the actual Delete command gets...
3
by: settyv | last post by:
Hi, I need to generate PDF stream when i click on Linkbutton in datagrid ..At present i hardcoded the DMS Id and now it is working.But i need to pass DMS ID when click linkbutton.How can i do...
18
by: rcoco | last post by:
Hi all, I have a datagrid with Button column select in form of hyperlink. On the same page, I have another datagrid that insert data and one column(Name) has Names of a user that is inserting...
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...
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
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,...
0
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
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: 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 ...
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.