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
Solved

asp.net gridview onclientclick parameter

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
run a stored procedure from vb.net 1 27
How to extract certain lines from textfile and save them to another file? 6 26
Easy filter aspnet 2 27
SSRS Deployment problem 5 65
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 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