Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

c# auto fill on webpage

Posted on 2011-02-23
3
Medium Priority
?
461 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:teera
  • 2
3 Comments
 
LVL 3

Expert Comment

by:kraiven
ID: 34959579
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.
0
 

Author Comment

by:teera
ID: 34961215
Hi

  I use webcontrol on c# in windows application please suggest
0
 
LVL 3

Accepted Solution

by:
kraiven earned 2000 total points
ID: 34961372
Sorry; aren't you talking about a web page?

Web controls in ASP.Net are those that have the tag
<asp: textbox ...>

Open in new window

for example. These are implemented automatically as controls which will runat server and which have control ids. The runat="server" attribute causes actions to automatically execute server code in your code-behind file. These controls are also exposed to your code-behind so that the server can write and read control properties such as .Text for a textbox.

You can apply similar functionality to standard HTML controls by adding the runat="server" and an id attribute as described above.

Not sure if that is what you want.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question