Solved

asp.net gridview onclientclick parameter

Posted on 2016-08-22
3
48 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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