Solved

c# auto fill on webpage

Posted on 2011-02-23
3
450 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
itextsharp with c# 3 35
C# LINQ 5 45
c# ftp code 3 56
UWP: Create an Image/Bitmap, Draw another image on it an save. 1 46
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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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