472,341 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,341 software developers and data experts.

how to raise an event from a HyperLinkField in a gridview (ASP.NET C# Web App)

32
Hi,

Just wondering if there is a way to do the above, as I need to check some values on from the gridview before it uses the DataNavigateUrlFormatString to post to another page.

Thanks
Janet
Jun 15 '07 #1
2 7486
kenobewan
4,871 Expert 4TB
I would convert your Bound field to a Template Field with a LinkButton to display value rather than using a HyperLinkField.

You can then set the CommandName of the link button - you could use Select in which case you can use the SelectedIndexChanged event. If you use a different CommandName use the RowCommand event and test e.CommandName to check which command (and therefore column) raised the event.

If you use the SelectedIndexChanged event it's easy to get the row index e.g. GridView1.SelectedIndex

If you use RowCommand there are various ways to retrieve the rowindex, I generally use the RowDataBound event of the GridView and FindControl to find the linkbutton, then set button's CommandArgument to the RowIndex. e.CommandArgument is then available in the RowCommand event. HTH.
Jun 16 '07 #2
dixonjm
32
That's great - sounds exactly what I need.

Many thanks
Janet
Jun 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bruno Alexandre | last post by:
in the form I have: <asp:TextBox ID="fAte" Runat="server" Width="80px">31-01-2004</asp:TextBox> in the GridView I have: ...
0
by: shellyshao | last post by:
Hi everyone, I have tried looking everywhere to fix this. Any help would be appreciated. Situation: Developing a web application for company...
8
by: =?Utf-8?B?TWlrZSBSYW5k?= | last post by:
I am trying to get a list of files from a specified directory using the System.IO namespace classes, and then use that list as the datasource for a...
7
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! ...
8
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the...
0
by: bodamithun | last post by:
Hi all, For some weird reason my hyperlinkfield does not work. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"...
1
by: boevermann | last post by:
I prototyped an html table that has a hyperlink that pops a window showing a map of the entry from the that table. The link looks like this: <a...
1
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
Hello: I have a hyperlink field in my gridview that redirects to a new page. I would like to set a session variable to a value from the grid row...
4
by: Jeff | last post by:
Hi asp.net 2.0 I'm trying to implement a HyperLinkField into my GridView.. The SqlDataSource returns a field which is paths to files (each row...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.