Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2004, 02:25 AM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to fill a textbox with a datalist.

I'm building a site for a non-profit that lets each participant in its program create a personalized page. The page has a bunch of labels filled by a datareader with the participant's name, fundraising goal, etc. There also needs to be an area that lists all the people who've donated to the participant and the amounts they donated. The thing is, if there are a lot of donors this list could get very long so it needs to be contained so it doesn't take up a ton of space (i.e. put the list of donors in a multiline textbox that allows the whole list to be scrolled up and down).

Is there a way to put a datalist inside a textbox or textarea or to fill a textbox w/ the info from a datalist?

Might using html controls instead of asp:textbox work? I'm fairly new to programming so please don't assume I know anything beyond the bare basics.

Your help is very much appreciated.

Daniel
 
Old June 29th, 2004, 06:59 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

If the datalist is populated from the database,use the datareader and use the below logic to fill the textbox.
Here strRead is the DataReader object and in the table i have only two columns.
if(strRead.HasRows)
    {
    TextBox1.Rows =strRead.FieldCount ;
    while (strRead.Read())
    {
    TextBox1.Text = TextBox1.Text +" " +strRead.GetValue(0) +" ," + strRead.GetValue(1);
    }
}

 
Old June 29th, 2004, 12:42 PM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Santhi. Could you please post the code above in VS.NET.

Dan
 
Old June 29th, 2004, 02:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Dan... umm... what would visual studio have to do with this?

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old June 29th, 2004, 04:00 PM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Hal Levy
 Dan... umm... what would visual studio have to do with this?

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Whoops. Meant VB.NET.
 
Old June 29th, 2004, 04:01 PM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ltdanp21
 Thanks Santhi. Could you post the code above in VB.NET.

Dan
 
Old June 30th, 2004, 12:12 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Hi Dan,Here is the code in VB.NET

If strRead.HasRows Then
  TextBox1.Rows =strRead.FieldCount
  Do While strRead.Read()
     TextBox1.Text = TextBox1.Text &" "& strRead.GetValue(0) &" ," & strRead.GetValue(1)
  Loop
End If







Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist inside datalist amit.jagtap ASP.NET 2.0 Professional 1 September 4th, 2007 05:03 AM
pointing cursor from one textbox to other textbox lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 2 August 2nd, 2007 03:41 PM
"fill" is different from "load" salemkoten Visual Studio 2005 0 October 23rd, 2006 04:24 AM
Masked TextBox & formatting TextBox melvik C# 1 September 22nd, 2003 11:01 AM
fill a table Warbird Classic ASP Basics 2 August 5th, 2003 09:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.