将文本框值从子页面传递到父页面中的gridview文本框?

问题描述:



我在父页面中有一个带有文本框的网格视图。当我点击网格视图文本框时,子页面窗口打开,我从子网格视图中选择值。我喜欢将该值传递给父网格视图各自的文本框。

我怎样才能实现这一点。请给我一个建议?

Hi,
I have a grid view in the parent page with text boxes. when i click on grid view text boxes child page window opens where i am selecting values from child grid view. I like to pass that value to parent grid view respective text boxes.
How can i achieve this.Kindly give me a suggestion?

Gopi,你有两种方式:

代码背后:

Gopi for that you have two ways :
from code behind :
var parentControl =(HiddenField) Parent.FindControl("ControlID");
            parentControl.Value = txtBox.Text;







来自javascript






from javascript

function assingValue() {
             parent_window.document.getElementById('hdnFieldValue').value = document.getElementById('txtbox').value;
         }


有很多方法可以实现这一目标。您可以根据您的要求选择其中一个。请在这里阅读。



http://msdn.microsoft.com/en-us/library/vstudio/6c3yckfw(v = vs.100).aspx [ ^ ]



http://www.codeguru。 com / columns / dotnet / passing-data-between-pages-in-asp.net.htm [ ^ ]



请接受/投票如果它可以帮到你。



谢谢
There are so many ways you can achieve this. You can take one of them according to your requirement. Please read here.

http://msdn.microsoft.com/en-us/library/vstudio/6c3yckfw(v=vs.100).aspx[^]

http://www.codeguru.com/columns/dotnet/passing-data-between-pages-in-asp.net.htm[^]

Please accept/up vote if it helps you.

Thanks