Click here to Skip to main content
15,885,878 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi all,

How to pass a value from popup window in Repeater control to parent form's TextBox?

Following data is parent window:
XML
<asp:TextBox ID="txtInsuranceName" runat="server" MaxLength="24"></asp:TextBox>
                       
                        <asp:ImageButton runat="server" CommandArgument="AutoSearch" CommandName="AutoSearch" ID="imgAutoSearch" ImageUrl="~/Images/search.gif" />

Following data is popup window data:
XML
 <%#DataBinder.Eval(Container.DataItem, "InsCarrierName")%>
<asp:Button runat="server" ID="btnSelect" Text="Select" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "InsCarrierId")%>' CommandName="Select" />
Posted
Updated 22-Oct-10 23:04pm
v2

C#
Use Session variable to store the value from popup , and access it in the parent page

Before closing the popup ,store the desired value in a Session variable:
Session["Data"]="DesiredValue";
After returning to the parent page ,get value from the Session Variable:
txtInsuranceName.Text=Session["Data"].ToString();
:-D
 
Share this answer
 
v2
Now Solved the problem..also used below code...using the Repeater control..

XML
<script type="text/javascript" language="javascript">
        function GetRowValue(val,name) {
            // hardcoded value used to minimize the code.
            // ControlID can instead be passed as query string to the popup window
            window.opener.getRowvaluepopup(val,name);
            window.close();
        }
    </script>




C#
function openpopup() {
    window.open("http://localhost:3438/AutoComplete/popupPatInsurance.aspx", "List", "scrollbars=no,resizable=no,width=400,height=280");
    return false;
}
function getRowvaluepopup(val,name) {
    //window.opener.document.getElementById("ctl00$body$txtInsuranceName").value = val;
    //window.close();
    document.getElementById("ctl00_body_txtInsuranceName").value = name;
    document.getElementById("ctl00_body_DivAutoCompleteInsName").value = val;

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900