?
Solved

how to make rows clickable, datagrid, in asp.net

Posted on 2012-08-16
1
Medium Priority
?
711 Views
Last Modified: 2012-08-20
I have created coding to read xml file, place it in dataset and put it in datagrid. However I want to make the rows clickable each row opens a specific page.

            XmlDocument loadXML = new XmlDocument();
            loadXML.Load(Server.MapPath("Data.xml"));
            XmlNodeReader xmlReader = new XmlNodeReader(loadXML);
            DataSet dataSet = new DataSet();
            dataSet.ReadXml(xmlReader);

            myDataGridviewV2.DataSource = dataSet;
            myDataGridviewV2.DataBind();

Open in new window

0
Comment
Question by:dipster307
1 Comment
 
LVL 12

Accepted Solution

by:
rajapandian_81 earned 2000 total points
ID: 38300011
Hi,

Refer the following links:
http://www.aspdotnetfaq.com/PrinterFriendlyFaq/How-to-correctly-highlight-GridView-rows-on-Mouse-Hover-in-ASP-NET.aspx
http://code.msdn.microsoft.com/GridViewRowEventSupport-48597096
http://www.netomatix.com/development/gridviewrowhighlight.aspx

In datagrid's "OnRowCreated" event, you can add the "onclick" attribute for each row and redirect to different page on row click.

For eg.,
e.Row.Attributes.Add("onclick", "window.location.href='" + e.Row.Cells[0].Text + "'");

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 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