Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

c# auto fill on webpage

how can I fill  "MyUserName" on


 <td width="18%" class="more"><div align="right">¿¿¿¿¿¿ </div></td>

                                <td width="82%"><font color="#FFFFFF" face="MS Sans Serif, Tahoma, sans-serif">
                                  <input type=text name="QTitle" size=51 maxlength=100 class=violet>
                                </font></td>


the full page is

http://www.kumnunrdnoppakhun.go.th/webboard/new.php

private void webBrowser2_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }

        private void LoadProfileInformation()
{
DataSet dsNew = new DataSet();

//Some code to fetch information if you store it in a DB else you can put in static info if you may want. //so you will nto need the dataset.



QTitle.Text = "MyUserName";


}
       
    }
}

Open in new window

Avatar of kraiven
kraiven

Hello,

you can't automatically reference standard HTML tags from your ASP.Net server-side code. To make a HTML control visible to your code-behind you need to add the following 2 attributes to your input control (this same rule applies to most HTML controls running under ASP.Net)
runat="server"

Open in new window

and
id="MyInputBox"

Open in new window

(obviously this id can be any unique name).

i.e. change your input tag to:

<input type=text name="QTitle" size=51 maxlength=100 class=violet id="QTitleTextBox" runat="server">

Open in new window


You can then set the value from your code-behind as:

QTitleTextBox.Text = "MyUserName";

Open in new window


Hope that helps.

P.S. Alternatively you can use ASP Web controls which default these attributes.
Avatar of MrTV

ASKER

Hi

  I use webcontrol on c# in windows application please suggest
ASKER CERTIFIED SOLUTION
Avatar of kraiven
kraiven

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial