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 September 12th, 2007, 07:24 AM
Registered User
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Display an Empty DataGrid on Page Load

I have created a DataGrid to accept inputs in textboxes in two TemplateColumns and display results after concatinating by clicking the concat button and showing the result in the results column. I just want to Display empty grid on Page Load first and accept inputs in textboxes and show Concat buttons. How can I do that? I am new to DataGrid and asp.net eventhandling but not new to programming. Following is the sample HTML that I am using. What should I do in Page_Load method?

<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute; TOP: 80px"
                runat="server" BackColor="Silver" ForeColor="Blue" Font-Size="Small" Font-Names="Courier New"
                HorizontalAlign="Center" AutoGenerateColumns="False" BorderColor="Blue" Visible = "True" >
                <EditItemStyle Font-Size="Small" Font-Names="Times New Roman" ForeColor="Red" BackColor="Silver"></EditItemStyle>
                    <asp:TemplateColumn HeaderText="String1">
                            <asp:TextBox id=TextBox1 runat="server" AutoPostBack="True">
                    <asp:TemplateColumn HeaderText="String2">
                            <asp:TextBox id=TextBox2 runat="server" AutoPostBack="True">
                    <asp:TemplateColumn HeaderText="Concat Buttons">
                            <asp:Button ID="Button1" Runat="server" Text="Concatinate"></asp:Button>
                    <asp:TemplateColumn Visible="False" HeaderText="Result"></asp:TemplateColumn>
Old September 13th, 2007, 10:00 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Logically, you can't display an empty grid. What is there to display?

You need to have at least 1 item bound to the grid for anything to show up, this item can result in all the inputs being empty, which would essentially amount to a new item.

What are you going to concat to? Other items in the grid (i.e are you trying to use the grid to build a list of items)?


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display 'Empty data' when fill datase cJeffreywang ASP.NET 2.0 Basics 2 August 28th, 2008 11:57 PM
datagrid does not display next page vhrao ASP.NET 2.0 Basics 9 July 22nd, 2007 12:28 AM
Page Header Printing on Last Empty Page ritag Access 4 November 11th, 2004 12:07 PM

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