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

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

Send values to parent window on gridview click event

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

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.

View Complete Post

More Related Resource Links

Gridview RowCommand Event returning null values

HiI'm trying to retreive values entered by users in the textboxes in the footer of the gridview and insert these values into another sql table.My code is as follows :-protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)    {       if(e.CommandName.Equals("addnew"))       {                       TextBox t1 = (TextBox)GridView2.FooterRow.FindControl("tfrm");            string frm = t1.Text;            TextBox t2 = (TextBox)GridView2.FooterRow.FindControl("tsub");            string sub = t2.Text;            string cmd = "insert into suggestions values('" + frm + "','" + sub + "','c','c')";            con.Open();            SqlCommand com = new SqlCommand(cmd,con);            int a = com.ExecuteNonQuery();&n

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. 

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!

How to send a Linkbutton through a Webservice with a click event.


hi everyone,

i want to return a linkbutton from my webservice with a click event handler.

I want that when a user click on that button the code i have returned in its event handler would be called...

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.

Dynamically Loaded UserControl, receiving the click event from UserControl to Parent Page



   In a page , when I click a button 'showDialog' I am loading the user control dynamically in a dialog.  I am linking to the event in the user control as explained below. The parent page is not receiving this event.

  ex: (This is in the page class)


         UseControl1 gc = dlg.LoadContent(:\UserControl1.csx);

        gc.CausePostback += new EventHandler(execute_CausePostback());



   // I am trying to update the details grid in parent page


In UserControl class after clicking the submit button


  raise event CausePostBack();


Any help is appreciated.



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>

Child window getting minimized when i click on parent window using window.open



we are opening window.open pop-up as child-window from parent window. When i click on parent window then child window is getting minimized.

Is there any solution for making child-window not to be minimized when i click on parent window.

And child-window should not have minimize and maximized buttons. It should only have close button.(ie., I should be similar as ShowModalDialog ie., look and feel and functionality also).

GridView Parent Child View with JQuery Effects

I was just checked how to add some more cool effects to the GridView control using JQuery. In this post I will display parent-child data in the GridView control with some help of the wonderful JQuery library.

Let's first populate the GridView control.

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.

Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


Thanks in advance

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

determine the best way to refresh a gridview when textchanged event occurs


Good afternoon.

I have the following gridview inside an updatepanel that makes the bind from a datatable:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
                <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" 
                    CssClass="Grid" Width="100%" CellPadding="4" ForeColor="#333333" 
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <asp:Button ID="AbrirModal" runat="server" Text="->" /> 
                                <asp:PopupControlExtender ID="PopupControlExtender1" runat="server"

update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

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