在弹出窗口中分配文本框值 [英] Assign a Textbox value in popup window

查看:69
本文介绍了在弹出窗口中分配文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我有一个名为Employee.aspx(form name = form1)
的页面 我在哪里使用Usercontrol(id ="ucEmployeeDetail")
IN用户控件-
文本框(id = txtOfficer)和一个链接
单击链接"后,将打开一个名为EmployeeList.aspx的弹出窗口,打开页面,
在此网格UserControl(id = EmployeeSearchResult)中,在模板"字段下的Asp链接按钮(Id ="LnkEmpName")..

现在,我想通过调用链接按钮(id ="LnkEmpName")的onClientClick通过js为Employee.aspx页面的Textbox(id ="txtOfficer")赋值.
我的问题是
在Onclientclick上应该写什么(表示如何传递链接按钮文本值)?
分配TextBox值的代码..?

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..?

推荐答案

您可以在弹出窗口中使用window.opener.document.getElementById(''txtOfficer'').value 来访问父窗口的文本框.请注意,由于您使用的是用户控件,因此在将控件名称呈现给客户端时,它们的名称可能会有所不同(即ctl00_txtOfficer).我建议您在浏览器中呈现HTML源代码时查看它,以确定文本框的正确名称.
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.


这篇关于在弹出窗口中分配文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆