Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 22nd, 2003, 10:45 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding datagrid programmatically at a specific pos

Hi everyone,

I have a datagrid question again. I have to insert some datagrids in the page at run time.

I generate my DataSet and bind it to my datagrid and add it as:

datagrid.DataSource = testData.Tables[0];
datagrid.DataBind();
Page.Controls.Add(datagrid);

everything works fine, except the datagrid appears at top of table. Is there a way to have it at the bottom of the page lke after the longest control.

Thanks for any help you might give me.

Sincerely,

Pankaj

  #2 (permalink)  
Old October 22nd, 2003, 10:55 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Put a PlaceHolder control in your form where you want the datagrid to go, then you can just add the grid to the placeholder.controls collection.

Peter
  #3 (permalink)  
Old October 22nd, 2003, 11:03 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there!

Thanks for the reply. i tried it out. However, I cannot move the place holder other than the top left of my web form. Is that normal??! I would olike the grid to appear on the bottom of the page.

Thanks,
Pankaj

  #4 (permalink)  
Old October 22nd, 2003, 12:41 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Did you put the placeholder in the ASPX of your form or did you add that programmatically as well? Any time you add controls programmatically to page.controls they will end up in one of two places: the beginning or the end of the form, before or after (repectively) all the other controls in the form. If you place a <asp:placeholder> in your form's html code where you want the dynamic grid to show up, then the grib will appear there.

Peter
  #5 (permalink)  
Old October 23rd, 2003, 03:10 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I used the design mode and added the placeholder in design view. However, I put it in a panel and it worked fine. Weird...

Thanks again,

Pankaj

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Event Handling Programmatically Wallhood Excel VBA 2 August 30th, 2007 10:42 AM
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
Adding List Item Programmatically rit01 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 February 12th, 2006 04:51 PM
How To Print specific Web Control like datagrid. qadeerahmed Classic ASP Basics 0 August 15th, 2005 11:25 PM
datagrid control and specific sql where clause Krosser VB.NET 2002/2003 Basics 0 July 25th, 2003 07:05 AM



All times are GMT -4. The time now is 12:27 AM.


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