.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

>>>Click in GridView row item.<<<

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net


I want to click in gridview row ITEM and it will show the result in next page.

For this purpose I used following code in my previous project but the code used in aspx.net.

That is very complicated.

Anyone have idea that how we may write same in vb.net and in which event?

<asp:TemplateField HeaderText="Total Pending">
               <asp:HyperLink ID="Pending_today" runat="server" NavigateUrl='<%# string.Format("PendingToday.aspx?Department={0}&Final_section={1}&Section={2}&Statement_Date={3}&Sr_Date={4}", Server.UrlEncode(Eval("Department").ToString()), Server.UrlEncode(Eval("Final_section").ToString()), Server.UrlEncode(Eval("Section").ToString()), Server.UrlEncode(Eval("Statement_Date").ToString()), Server.UrlEncode(Eval("Sr_Date").ToString()) ) %>' Text='<%#Eval("Pending_today")%>'/>
        <HeaderStyle Width="60px" Wrap="False" />
   <ItemStyle Width="60px" Wrap="False" />
  <ControlStyle Font-Underline="False" ForeColor="Blue&

View Complete Post

More Related Resource Links

GridView Javascript Click Row and Ajax

This article shows 2 common tasks with the ASP.NET GridView: Binding a List (generic) of objects as DataSource and on clicking a row, getting the values of the selected row by a javascript function. In the example a List with User-objects is displayed. On clicking a row containing the data of a User-object, the Id of the object is used to get the address of the user by an Ajax-call and display it in a details-field.

Dynamically creating Gridview Template - Linkbutton Click not working



I have written some code to dynamically generate template columns for gridview which works well. However, each cell in the gridview has to be a linkbutton, which when clicked does a db update and redirects to a specific url with some parameters in it.

I have attached a click event handler to the linkbutton in the InstantiateIn method but the event does not seem to fire.

Could someone please help? the code is below -

//Dynamically creating the Grid

protected void btnAnalyze_Click(object sender, EventArgs e)

listview with button in item template - how do I handle the click event?

Hello,Using a listview control for the first time... I need a button for each item, and of course I need to handle the click event for the buttons... upon clicking a particular button I of course need to know which item the button is associated with so the appropriate action can be taken...In VS, I can't select the button and see my list of available events in the properties window like is normally done for controls outside of templates like this... what do I need to do?

Remove action that appear in the menu which appears when we right click each individual item in libr

i need to remove or hide edit properties menu from  menu which appears when we right click each individual item in library 

Alert popup on Gridview Textbox Click

Hi,I am trying to make a Javascript Alert appear when someone clicks on a textbox that is part of a Gridview. the textbox is an Item template and I have an onclick="NotePopup()" in the TextBox properties. I am having trouble grabbing the correct ID of the text box, because it is nested inside a gridview. I have been looking around on Google for a solution but none of the responses are working for me.  The gridview will have multiple rows, so each textbox that could potentially be clicked will have a different ID, is there any way to pass the correct ID to the Javascript, or have the Javascript function grab the correct ID?I did use var Control = '<%= GridView1.ClientID %>';then cut and paste the ID from ViewSource of a textbox and append it to the Control Variable,  to test out the popup and it does workThanks for your helpChris

Gridview and delete option - Button click displays message

Hi, I have a gridview connected to a sql database that allows the user to delete the record. I used the ASP.net automatic "options" for this. However, I would like when the user deletes a record, a message (textbox) appears in the form to say the record has been deleted. Please can anyone provide some sample codes?   Thanks in advance. Nijojo.

Update a field in a gridview to False on a Button Click

 Hi, Ive got a list of records in a gridview (from an SQLDataSource) where a field value is set to True.  I've also added a "reset" button in a template field at the start of the row in the Gridview. What I would like to do is allow the user to click the reset button on a particular row and 'reset' the true value to 'false' (updating the source data). Are there any idiot proof tutorials to do this??? Many thanks for your help! Fiorano

Build xml file from gridview values on button click

We are looking to add GoogleMaps to our application. With that said we are going to be using the geocoding api to pass in the lat and long values to pin point locations on the the map. Reading thru the documentation we can pass in the values via XML, so we would like to see how we can take the lat and long values from our gridview and pass that to the API if and when somone clicks on the button to show the map.. The process will work like so, you arrive at the search page, you complete a search, in most if not all cases, you will always get multiple results presented in a gridview. If you should to view them all on the map, you click button and it needs to map out each location on the map. So is there anyway to pull from the gridview the lat, long and description to pass into the API?   Any links to sites that i can review would be great. thanks. 

Send values to parent window on gridview click event


Hello all,

I have a form, which contains 2 textboxes. When i click on the first textbox, i have to open a child window (tool), that contains a gridview control with 2 columns (corresponding to the 2 textboxes). When the user clicks on any row in the gridview, it should send back the 2 column values back to the parent window to the corresponding 2 textboxes. Can anyone help me on how do i achieve this?

I can open the child window and get back the values using window.opener method in JS. 

But can anyone help on how to bind the JS code to the onClick of every row in the gridview. How can i activate the OnClick event of every row/alternating row item of the gridview and bind the JS code and pass each column value to that JS method? The no of columns in the gridview can vary depending upon the data? So in that case, i have to have a collection to be passed to JS code that can contain n number of column values.

Please help.

On GridView Click, populate other controls with column values


Hello team,

I have 5 controls on the page - textbox, radiobutton, listbox, checkbox, and any other one more. And i have a grid. The grid has 5 corresponding columns. I have to make the grid row clickable, and on the click, i have to populate my 5 controls with each of the corresponding grid column values.

Please let me know how can i make it. I know that i can make the grid clickable, by setting the e.row.attribute.add("OnClick", "javascript:return passValues();");. In this case, all the value passing will happen in javaScript. Is this the correct way? I have yet to try implementing this, not sure if there will be any issues.

Before that wanted to know if there is any other approach to achieve this. Please help!

GridView and mouse double click Response.Redirect problem


VS 2005, AJAX 

I use gridview and I need single and double click for each row in gridview.

When I click once on a row, some action will execute (e.g. next button should be enabled) and when I double click the row there should be redirection to another page.

I used the code below for both single and double click  usage:


protected void GwContainers_RowDataBound(object sender, GridViewRowEventArgs e)
                if (e.Row.RowType == DataControlRowType.DataRow)
                    // Get the LinkButton control in the first cell

                    LinkButton singleClickButton = (LinkButton)e.Row.Cells[8].Controls[0];
                    // Get the javascript which is assigned to this LinkButton


Gridview Link Button control click event


Respected Reader,

I have  Web page that uses LinkButton control inside Template Fields of Gridview.

I am trying to work on LinkButton Click event and trying to preserve the Value of LinkButton that user click, and based on that value, i want to refresh tha page data.

I used CommandName and CommandArgument property of Linkbutton, but i can use that property only in GridView_RowCommand method by checking e.CommandName expression. But the problem with that Gridview_RowCommand event fire after all other page_load activity. So the value never used in the page_load event to refresh the data in all other control.

I also tried to use OnClick Method, Session variable and Hidden variable. but when i run Response.Redirect method from Gridview_RowCommand, it clear all the Session and Hidden variable values. also tried (Response.Redirect(,false)) method but never got success.

Any suggestion will be appricated in advance.

Cannot add new row to gridview on button click



I got a function to load a grid view and works fine. Then, I got a button, when click, I wanted to add a new row into the grid, what I did is I add a new to to the dataset and rebind the dataset to the grid view.

The problem I faced is that is it able to add a new row, but it only shows ONE column only, which is the most left column.

protected void gvDetail_AddNewRow(object sender, System.EventArgs e)
            string strSQL = null;
            DataSet ds = new DataSet();

            lblError.Text = "";

            strSQL = "Select * From tmp_Detail_Data_vaio1045xjh02l55bw4vtrmg_09282010_132652";

            ds = clsDataAccess.clsDataAccess.RetrieveDataSet(clsDataAccess.clsDataAccess.ConnStringDataCollection, strSQL);

            if (ds != null)
                ContentPlaceHolder myContent = (ContentPlaceHolder)Page.Master.FindControl("CPHDetail");
                GridView gvView = (GridView)myContent.FindControl("gvDetail");


                gvView.DataSource = ds;




Any help?

Add Dynamically TextBox And DropDownList In Gridview on Button Click Wich is placed outside of Gridv


Hi All,

   I have Gridview and Button Control on Form.i want to Add Dynamically TextBox And DropDownList In Gridview on Button Click Wich is placed outside of Gridview.

When i click on Button -> One TextBox and One Dropdownlist which contains values bydefault 1,2,3 should bind to gridview.    Button is placed outside Gridview.

Thanks in advance.

Performing two events(saving and deleting item) on button click in javascript in a dataview web part


Hello guys,

I have a requirement like...I have a dvwp, in that I have comments field as text box. So that when ever user tries to delete the item, he enters comments and deletes it.It will send an notification with information and gets deleted.

So I have to do this by javascript. Do you guys have any idea?

Is it possible to have a click event handler on a HyperLinkField in a gridview?


Hi everyone-

I'd like to have a panel turn on when the user clicks on any link in the link column of this bound gridview.  I don't see how to set up the handler in the code behind. Is it possible?

<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" Width="710px" GridLines="None"> <Columns> <asp:BoundField DataField="clientComment" HeaderText="ID" /> <asp:HyperLinkField HeaderText="Click Here" _blank" DataNavigateUrlFields="clientID" DataNavigateUrlFormatString="../ClientComments.aspx?ID={0}" DataTextField="clientID" DataTextFormatString="<img src='../Images/ClientComment.gif' alt='Comment' border='0'/>" Visible="true"/> </Columns> </asp:GridView>

How to get Context Menu when i right click on GridView Column



When i right click on Gridview Column,Context Menu will be displayed.

When i click any of them in context menu it will display new aspx page.

Is it Possible w/o Java script?

Plz help me in that....I struck at that.


Rama krishna.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend