How to value set on TextBox
<p>Work on Asp.Net C# VS08.</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;


&lt;link href="StyleSheet.css" rel="stylesheet" type="text/css" /&gt;

    &lt;title&gt;Untitled Page&lt;/title&gt;
        &lt;link href="StyleSheet.css" rel="stylesheet" type="text/css" /&gt;    
    &lt;script type="text/javascript"&gt;
    var styleToSelect;
    function onOk() {
    document.getElementById('GridView1').className = styleToSelect;
    }
&lt;/script&gt;


&lt;script language="javascript" type="text/javascript"&gt;

    function GetRowValue(val) {

   // alert(val);

        document.getElementById("Text1").value = val;

        // hardcoded value used to minimize the code.

        // ControlID can instead be passed as query string to the popup window

        //window.opener.document.getElementById("ctl00_ContentPlaceHolder2_GridView1_txtCOM_NAME").value = val;
        //window.opener.document.getElementById('%=txtCOM_NAME.ClientId%&gt;').value = val;
        //window.opener.document.getElementById("txtParent").value = val;
        //Text1.innerHTML=val;
       // alert(val);


       // window.close();

    }

    function Hello()
    {
     document.getElementById("Text1").value="2";
    }
    &lt;/script&gt;





&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
        &lt;/asp:ScriptManager&gt;

    &lt;asp:LinkButton ID="LinkButton1" runat="server"&gt;Please click to select an alternate text style.&lt;/asp:LinkButton&gt;&lt;br /&gt;
        &lt;br /&gt;
        &lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt;&lt;br /&gt;
        &lt;br /&gt;
        &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
            DataSourceID="SqlDataSource1"&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
                    ReadOnly="True" SortExpression="CategoryID" /&gt;
                &lt;asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" /&gt;
                &lt;asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /&gt;
                &lt;asp:TemplateField&gt;
                    &lt;ItemTemplate&gt;



                        &lt;asp:Button ID="Button2" runat="server" Text="Button" /&gt;                       


                        &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
             TargetControlID="Button2"
             PopupControlID="Panel2"  



             BackgroundCssClass="modalBackground"
             DropShadow="true"

             OkControlID="OkButton"

             CancelControlID="CancelButton"

             OnOkScript="onOk()"




             /&gt;
                        &amp;nbsp;&lt;asp:TextBox ID="TextBox2" runat="server"&gt;&lt;/asp:TextBox&gt;


                    &lt;/ItemTemplate&gt;


                &lt;/asp:TemplateField&gt;

            &lt;/Columns&gt;
        &lt;/asp:GridView&gt;


        &lt;asp:Panel ID="Panel2" runat="server" Height="50px" Width="125px" CssClass="modalPopup"&gt;
                            &amp;nbsp;&lt;asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
                                DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" OnRowDataBound="GridView2_RowDataBound"&gt;
                                &lt;Columns&gt;
                                    &lt;asp:TemplateField HeaderText="ckb"&gt;
                                        &lt;EditItemTemplate&gt;
                                            &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
                                        &lt;/EditItemTemplate&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Label ID="Label1" runat="server"&gt;&lt;/asp:Label&gt;
                                            &lt;asp:CheckBox ID="CheckBox1" runat="server" /&gt;
                                        &lt;/ItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;
                                    &lt;asp:CommandField ShowSelectButton="True" /&gt;
                                    &lt;asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
                                        ReadOnly="True" SortExpression="CategoryID" /&gt;
                                    &lt;asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" /&gt;
                                    &lt;asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /&gt;

                                     &lt;asp:TemplateField&gt;
                                        &lt;AlternatingItemTemplate&gt;
                                            &lt;asp:Button ID="btnSelect" runat="server" Text="Select" /&gt;
                                        &lt;/AlternatingItemTemplate&gt;
                                        &lt;ItemTemplate&gt;
                                            &lt;asp:Button ID="btnSelect" runat="server" Text="Select" /&gt;
                                        &lt;/ItemTemplate&gt;
                                    &lt;/asp:TemplateField&gt;

                                &lt;/Columns&gt;
                            &lt;/asp:GridView&gt;
                        &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt;
            &lt;asp:Button ID="Button3" runat="server" Text="Button" /&gt;

                                &lt;div align="center"&gt;
      &lt;asp:Button ID="OkButton" runat="server" Text="OK" OnClick="OkButton_Click"  OnClientClick=Hello() /&gt;
      &lt;asp:Button ID="CancelButton" runat="server" Text="Cancel" /&gt;
                                    &lt;input id="Button4" type="button" value="button" /&gt;&lt;/div&gt;


            &lt;/asp:Panel&gt;

        &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:NorthwindConnectionString %&gt;"
            SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]"&gt;
        &lt;/asp:SqlDataSource&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        &amp;nbsp;



    &lt;/div&gt;

    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>After Popup .Want to select a row on popup grid then click on ok button and put the value on TextBox fo the parent grid.How to set value on Parent Grid.</p>
