?
Solved

asp.net gridview onclientclick parameter

Posted on 2016-08-22
3
Medium Priority
?
54 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 15

Accepted Solution

by:
Lokesh B R earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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