Click here to Skip to main content
15,922,696 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
HTML
<textarea name="details" id="details" cols="35" wrap="physical" rows="1"  önfocus="this.style.height='55px';" style="width: 300px; height: 55px;"></textarea>



2nd

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



C#
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}");

        }
Posted

1 solution

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

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