Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c# auto fill on webpage

Posted on 2011-02-23
3
Medium Priority
?
456 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

730 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