设置文本框的值 [英] Setting value of a textbox

查看:85
本文介绍了设置文本框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用texbox,我无法设置文本。我尝试制作一个函数SetText(namedetailsHello);但它不起作用。有什么想法吗?

1st

 <   textarea     name   =  详细信息    id  < span class =code-keyword> =  details    cols   =  35    wrap   =  physical     =  1     önfocus  =  this.style.height ='55px'; < span class =code-attribute>   style   = 宽度:300px;高度:55px; >  <   / textarea  >  







2nd



< textarea id =  < span class =code-string> sText cols =   50 rows =   5 name =   sText >  < /   textarea  >  







  void  SetText( string 属性, string  attName, string  < span class =code-sdkkeyword> value )
{


Skybound.Gecko.GeckoElementCollection tagsCollection =((Skybound.Gecko.GeckoWebBrowser)(tabControl2。 SelectedTab.Controls [ 0 ]))。Document.GetElementsByTagName( 输入);

foreach (Skybound.Gecko.GeckoElement currentTag in tagsCollection)
{

// MessageBox.Show(currentTag.GetAttribute(attribute));
// 如果当前标签的属性名称为attName

if (currentTag.GetAttribute(attribute).Equals(attName))
{

// 然后设置其属性value。

currentTag.SetAttribute( value value );

currentTag.Focus();
}
}



// SendKeys.Send({ENTER});

}

解决方案

你可以使用

TextBox1.text =abc;每次在page_load函数中

每当你的页面加载时它总会设置你的值

I have to texboxes, that I cant manage to set text into. I tried making a function SetText("name" "details" "Hello"); But it doesnt work. Any ideas?
1st

<textarea name="details" id="details" cols="35" wrap="physical" rows="1"  önfocus="this.style.height='55px';" style="width: 300px; height: 55px;"></textarea>




2nd

<textarea id="sText" cols="50" rows="5" name="sText"></textarea>




void SetText(string attribute, string attName, string value)
        {


            Skybound.Gecko.GeckoElementCollection tagsCollection = ((Skybound.Gecko.GeckoWebBrowser)(tabControl2.SelectedTab.Controls[0])).Document.GetElementsByTagName("input");

            foreach (Skybound.Gecko.GeckoElement currentTag in tagsCollection)
            {

               // MessageBox.Show(currentTag.GetAttribute(attribute));
                // If the attribute of the current tag has the name attName

                if (currentTag.GetAttribute(attribute).Equals(attName))
                {
                   
                    // Then set its attribute "value".

                    currentTag.SetAttribute("value", value);
                    
                    currentTag.Focus();
                }
            }



            //  SendKeys.Send("{ENTER}");

        }

解决方案

You can use
TextBox1.text="abc"; in the page_load function everytime
It will always set your value whenever your page loads


这篇关于设置文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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