Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys can any one help me ...i have two page parent page and child page and i have one text box on parent page and on child page i have my grid view and i want the row value of my grid view into the text box of parent page ...how can i do this please help me for this i am trying this from last 24 hours but failed
Posted
Comments
Krunal Rohit 24-Jan-14 0:26am    
What have you tried so far ?
vivek0041 24-Jan-14 0:31am    
i have tried java script but no use the value is not passing
JoCodes 24-Jan-14 0:31am    
Post the code you tried
vivek0041 24-Jan-14 0:39am    
sorry brother i have deleted the tried code because it was not working ....i was trying through java script
vivek0041 24-Jan-14 0:53am    
parent page ..

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server">
<input id="Button1" type="button" value="page2" önclick="javascript:window.open('page2.aspx');" />
</div>
</form>
</body>
</html>

child page

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function Clicked(ID)
{
window.opener.document.getElementById('TextBox1').value+=' ' +ID;
}
</script>

this code dose not returns any value into textbox

 
Share this answer
 
Use RowCommand Event:

Page1.aspx:
In Select Button of Gridview add command name:
ASP.NET
<asp:button id="Button1" runat="server" text="Button" commandname="Select" xmlns:asp="#unknown" />


In RowCommand event of Gridview:
C#
if (e.CommandName == "Select")
  {
      ImageButton img = (ImageButton)e.CommandSource as ImageButton;
      GridViewRow row = img.NamingContainer as GridViewRow;

      Label name = (Label)row.FindControl("label1");
      Session["Value"] = name.Text;


      Response.Redirect("page2.aspx");
  }


In page_load of page2.aspx:
C#
TextBox1.Text = Session["Value"].ToString();
 
Share this answer
 
ASP.NET
Try this...:

Aspx page :

         <asp:TemplateField HeaderText="Action">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkSelect" runat="server" Text="Select" OnClick="lnklnkSelect_Click" CommandArgument='<%# Eval("UrValue") %>'></asp:LinkButton>
                    </ItemTemplate>
        </asp:TemplateField> 

CS :

protected void lnklnkSelect_Click(object sender, EventArgs e)
    {
        con.Open();
        string lb1Value = ((LinkButton) sender).CommandArgument.ToString();
        Response.Redirect("UrPage.aspx?+lb1Value");
    }

Then in your parent page, get that value like :

if(Request.QueryString["lb1Value"] != null)
{
   TextBox.Text=Request.QueryString["lb1Value"];
}
 
Share this answer
 
v3

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