Solved

asp.net gridview onclientclick parameter

Posted on 2016-08-22
3
47 Views
Last Modified: 2016-08-23
I have a gridview with a column containing an asplink button which will delete the record in that row.  I could not figure out how to do it in the code behind so here is what it looks like in the page code:

<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                            CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this Employee?');"></asp:LinkButton>

I would like to add some more detail (a column or two in the gridview) to the message such as the employee first and last name.
0
Comment
Question by:schwientekd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Lokesh B R earned 500 total points
ID: 41766483
Hi,

Check the sample here
0
 

Author Comment

by:schwientekd
ID: 41767586
That looks like a great example and I can get the pop up message to appear but I cannot get it to pass the parameter.  I have tried this in a gridview which has textbox item template fields and also label fields.  Can it be that this method does not work with template fields?  This is the line which should be retrieving the parameter and I think is the problem I am running into.  Does it look correct?

Dim id As String = e.Row.Cells(3).Text
0
 

Author Comment

by:schwientekd
ID: 41767592
I changed the line above to this and it worked.

Dim id As String = TryCast(e.Row.FindControl("textBox1"), TextBox).Text()
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question