Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..

I am having a page named Employee.aspx(form name = form1)
Where i am using a Usercontrol (id="ucEmployeeDetail")
IN User Control --
Textbox(id = txtOfficer) and a link
On clicking on Link a popup window open named EmployeeList.aspx page open ,
in this a Grid UserControl(id=EmployeeSearchResult),in it a Asp Link button(Id="LnkEmpName") under Template field ..

Now, I want to assign value a Textbox (id="txtOfficer")of Employee.aspx page through js by calling onClientClick of Link Button(id="LnkEmpName")

My Question is
What should write on Onclientclick(Means How to pass a Link Button Text Value)?
Code to assign the TextBox value..?
Posted
Updated 31-Mar-11 6:18am
v2
Comments
Orcun Iyigun 31-Mar-11 12:21pm    
you want to be done by javascript but maybe you can use a session to pass the value to the popup.
like;
Session["EmpName"] = txtOfficer.Text; ( in your click event) and in your EmployeeList.aspx page you can have the value by
string empNameValue = Session["EmpName"].ToString();

1 solution

You can use window.opener.document.getElementById('txtOfficer').value from your popup to access the textbox of the parent window. Please note though that the control names may appear different(i.e ctl00_txtOfficer) when they are being rendered to the client since you are using a user control. What I suggest is you view the HTML source when its being rendered on your browser to determine the right name for the textbox.
 
Share this answer
 
Comments
Rajni from delhi 31-Mar-11 11:30am    
yah.. i know this .. act. i tried

window.opener.document.getElementById("uc..txtOfficer").value=

what should i right on Right hand Side..
Rajni from delhi 31-Mar-11 11:31am    
How I pass the value on ONClientClick?it shows me.. it's null or n't an object
walterhevedeich 31-Mar-11 12:27pm    
So you wanted to get the text of the linkbutton, is that right? if so, you can use document.getElementById('LnkEmpName').innerHTML. Sorry for throwing random answers here as Im quite confused by your questions. :)

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