Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Datagrid problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shruthialekha@gmail.com - 08 Feb 2008 14:35 GMT
I have created a datagrid in visual studio using C#. The dock is set
to none. The datagrid has 4 rows initially and scrollbar is enabled.
when I scroll down after the 4 rows I can see an empty space. I have
handled this problem using scroll event, but when I add another row I
can again see an empty space. Could anyone please tell how to handle
this so that I dont see the empty space.
Manish - 08 Feb 2008 19:03 GMT
Hi,

You can put the Grid in the div tag and set the Overflow:auto.

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   <title>Untitled Page</title>
</head>
<body>
   <form id="form1" runat="server">
 <div id='div1' runat="server" style="width:347px; height:195px;
overflow:auto; z-index: 100; left: 37px; position: absolute; top: 62px;">
       <asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" BackColor="#DEBA84"
           BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="2"
           DataKeyNames="ProductID" DataSourceID="SqlDataSource1"
Height="95px" Width="247px">
           <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
           <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
           <Columns>
               <asp:BoundField DataField="ProductID" HeaderText="ProductID"
InsertVisible="False"
                   ReadOnly="True" SortExpression="ProductID" />
               <asp:BoundField DataField="ProductName"
HeaderText="ProductName" SortExpression="ProductName" />
               <asp:BoundField DataField="SupplierID"
HeaderText="SupplierID" SortExpression="SupplierID" />
               <asp:BoundField DataField="CategoryID"
HeaderText="CategoryID" SortExpression="CategoryID" />
           </Columns>
           <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
           <SelectedRowStyle BackColor="#738A9C" Font-Bold="True"
ForeColor="White" />
           <HeaderStyle BackColor="#A55129" Font-Bold="True"
ForeColor="White" />
       </asp:GridView>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
           SelectCommand="SELECT [ProductID], [ProductName], [SupplierID],
[CategoryID] FROM [Alphabetical list of products]">
       </asp:SqlDataSource>
   
   </div>
   </form>
</body>
</html>

Regards,
Manish

www.ComponentOne.com

> I have created a datagrid in visual studio using C#. The dock is set
> to none. The datagrid has 4 rows initially and scrollbar is enabled.
> when I scroll down after the 4 rows I can see an empty space. I have
> handled this problem using scroll event, but when I add another row I
> can again see an empty space. Could anyone please tell how to handle
> this so that I dont see the empty space.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.