帮助使用多视图控件 [英] help using multiview control

查看:58
本文介绍了帮助使用多视图控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net中如何使用多视图控件(即视图1文本框到文本框视图4)将文本框值从一个复制到另一个... ..

In asp.net how to get copy textbox values from one to another, using multiview control(i.e view 1 textbox to textbox view 4)..

推荐答案

如果您在视图中对文本框进行了硬编码,那么您可以通过变量名称调用它们,并将文本值从一个设置为另一个。



If you hard-coded the textbox in the views then you can just call them by their variable name and set the text value from one to the other.

oTextBox4.Text = oTextBox1.Text;





但是,如果你动态地这样做,那么你需要使用



However, if you are doing this dynamically then you need to use the

FindControl(string controlid)

function。



function.

TextBox
    oTextBox1 = View1.FindControl("oTextBox1") as TextBox
    oTextBox4 = View4.FindControl("oTextBox4") as TextBox;
if((oTextBox1 != null) && (oTextBox4 != null))
    oTextBox4.Text = oTextBox1.Text;


answer是



TextBox4.Text = TextBox1.Text //这有多简单
answer is

TextBox4.Text=TextBox1.Text// how simple is that


这篇关于帮助使用多视图控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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