How do you get a class to populate text boxes on a form?

In my class I'm using a data reader to read data:

aReader.Read();

string UserID;

UserID = (String)aReader.GetValue(0);

UserID = (String)aReader.GetValue(1);

UserID = (String)aReader.GetValue(2);

How do I get the values to txtOne, txtTwo, and txtThree on the form?

0
bthumber
3/26/2007 7:49:39 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
681 Views

Similar Articles

[PageSpeed] 45

For example:

myTextBox.Text = aReader.GetString(0);

The myTextBox is the ID of the TextBox added to a page. When you add a TextBox control on to the page. The specified ID can be used to get access to the control's instance.


/Fredrik Normén - fredrikn @ twitter

Microsoft MVP, MCSD, MCAD, MCT

ASPInsiders
My Blog
0
Fredrik
3/26/2007 7:55:19 PM
My problem is the reader is in the class and the textbox control is on a different aspx page.
0
bthumber
3/26/2007 8:30:32 PM

hello my friend,

define a public string in your class and in the .aspx page use the class object to retrieve the public value

suppose your class name is Class1 and define a public string called UserID

public string UserID

and then in the .aspx page

Class1 c1=new Class1();

TextBox1.Text=c1.UserID

hope it helps,

Jessica


Jessica Cao
Sincerely,
Microsoft Online Community Support


“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
0
Jessica
3/27/2007 1:22:54 AM
Reply:

Similar Artilces:

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin = window.open('foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

VB .net Web Form will not get contents of Text Box
I have created a web form with text boxes that are bound to a DataSet/DataView.  I have created button to navigate up and down the recordset.  That all works fine. I need to have the ability to edit/add text in any of the boxes and then when clicking "Save" button, it would build an UPDATE query to send to the database. When the Save button is clicked, I have coded to DIM a string var (strSQL) to use to build the SQL command.  For some reason, it will only get the text from a text box if the data was pulled the database.  If I add/edit data, then the SQL command will ha...

Populate text box on a different web form
Hello All I have a button and a textbox on my Default aspx page, (Using VB),  when i click it i want to open my page customers.aspx and populate textbox1 with the details from the textbox on my default page, Can anyone point me in the right direction please thanks gibbo   You can use the session variables to save the textbox text of the Default page and retrieve it from the customers page // To Save the value of the textbox on the Default page use the below code Session("Textbox") = TextBox1.Text // To retrieve it from customers page and set it as the text ...

Getting error while disabling the text boxes on Web Form
Hello Folks...THis is very urgent ...Plz help...Following is a piece of code....to disable all the textBoxes on a WebForm in ASP.Net.(Lang:VB.Net) Private Sub disableAllTextBoxes(ByVal ControlArray) Dim control As Object Dim temptxtbox Dim i As Integer For Each control In ControlArray       If control.GetType.Name = "TextBox" Then          control.GetType.GetTypeArray(control).CopyTo(temptxtbox, 0)          For i = 0 To UBound(temptxtbox)     &n...

Open web page in IE and populate fields on the form from my web form
To the dot net Knights.  Many humble thanks in advance from a dot net surf. We have an vb application that opens multiple instances of IE object, each to different web pages.  It then takes information from the current record in the app, populates fields on each of the web pages, and them submits the forms.  We are then able to look at the resulting web pages and quickly get the info we're looking for.This prevents us from having to manually navigate to each web site, enter the same information and then wait for the page to open.  If there is ...

Passing Text of a text box in child form to a label in parent form
Hi Elite People !! I have a parent form with a number of ASP Labels and Buttons. Each ASP Label has a ASP Button next to it. What I want to acheive is when you click the button, it should open a new window with a ASP multiline text box and a "save" button. User can enter the text in the text box and when they click the SAve button, the Text in the text box of the Child window should be displayed in the label on the parent form.  I am successfully able to do this when I have a Text Box in the Parent form, but my requirement is to use Labels on the Parent Form. I am ...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Submitting Web forms fields to sql database by clicking on SUBMIT FORM and sending the form fields to email box
I have a created or designed a form to be stored in a SQL database table and at the same time when a user clicks on SUBMIT button the form fields will automatically goto the visitor email address immediately. Also i have created a database with tables for each of this forms Pls help i have over 10 forms designed but the problem of submitting them to the table database and the user email address is the challenge now.... You ned to familiarise yourself with the basics of database access in ASP.NET.  There are free tutuorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/da...

Populating a pdf form with data from a web form
Problem: How do I populate a pdf with data from a web form? I have created a web form that functions in the following ways:User navigates to the registration part of the site and fills out form data (i.e. First, Last Name, Phone, Organization, City, State, etc.). Upon hitting the submit button a subroutine is executed and an automated email is sent to our marketing director, notifying her of the registration taking place. Simultaneously the Submit button also opens a pdf that the user is to print out and mail us (along with their payment) to complete their registration. For usability purpose...

getting values from a web form to windows form
Hot Requirement ..... Is there any possible of getting values from a web form to windows form ????? Yes One way i to use the WebRequest and WebResponse classes of the System.Net namespace. For example:  WebRequest request = WebRequest.Create("URL of the web page); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string content = reader.ReadLine(); ....    Reza Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way fut...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

how to place a <form> in web form form
i placed a <form> in the web form, but i can't submit coz i neet to submit to another web site how can i do??? Mike Chan You cannot submit a <form> to another page if you have a RunAt="Server" in the form tag. Remove that RunAt="Server" and you can (though then you will need to use plain old HTML inside that form). What are you trying to do? Why do you need to post to another form?Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog COZ I NEED TO POST SOME INFORMATION TO ANOTHER WEB SITE IS THERE ANY OTHER SOLUTION?M...

Web resources about - How do you get a class to populate text boxes on a form? - asp.net.web-forms

Facebook Fans Populate National Car Rental Playlist
... its Facebook fans are listening to, so the company teamed up with music-streaming service Songza to allow users who like its page to help populate ...

Facebook Launches Integrations With Spotify, Netflix and More to Populate the Ticker with Playable Content ...
A wide variety of media partners and news publishers have partnered with Facebook to allow uses to publish content to the site that can be immediately ...

Perish the populate thought
Population size and growth, resources and climate change are obviously linked.

Islamic State militants raping thousands of women to populate caliphate, Iraqi official claims
ISLAMIC State fighters are reportedly raping thousands of women in Iraq and Syria to mass-produce spawn who&#8217;ll follow in their footsteps. ...

Researchers craft bot to populate Wikipedia with gene data
In order to help make Wikipedia a better source of information for biologists …

Are Chuck Schumer and Steve Israel Working To Populate Congress In The Image Of Scoop Jackson?
History lesson: In 1972 and again in 1976, the Beltway's conservative Democratic Establishment had found its man. The preferred candidate of ...

Extreme Shrimps Could Possibly be Sent to Populate Europa, NASA Reports
Rimicaris hybisae live on the edges of hydrothermal vents 7,500 feet underwater whose temperatures reach 750 degrees Fahrenheit.

Glowing robotic tentacles populate this Petting Zoo
(Credit: Minimaforms) If you swing by the Petting Zoo in Orleans, France, don't expect to see goats. The robotic "pets" that reside there hang ...

CNN.com - Millionaires populate U.S. Senate - Jun. 13, 2003
The U.S. Senate showed once more why it's sometimes called the millionaires' club.

Pokémon 2DS bundles soon to populate Australian store shelves
Australian gamers who have yet to pick up Pokémon X and Pokémon Y will be able to purchase one of two new Nintendo 2DS system bundles on June ...

Resources last updated: 1/2/2016 6:15:53 AM