Solved

c# auto fill on webpage

Posted on 2011-02-23
3
442 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
Comment Utility
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
Comment Utility
Hi

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

Accepted Solution

by:
kraiven earned 500 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now