Solved

Datagrid with Multipage (.NET)

Posted on 2002-04-14
17
199 Views
Last Modified: 2008-03-06
Hi All,
First of all i am a newbie for webdevelopment.

I have the following problem:

i have a datagrid inside a table cell.

I have a datagrid that contains too many lines that when rendered, it brings a horizantal scroll to the page,

i've set the datagrid height to 100% and the width to 100% so that it appears and expands as the case needs ( i don't know the actuall width and height after rendering).

Customer decided that the scroll should appear only for the datagrid, so i've put it into a multipage, and set the multipage height to 100%, but the width to 700px (which fits well inside the page).

now, imagine with me that the rendered page will be 500px height and 1200px width.

so the multipage's height is set to be 500px, no because the grid width is 1200px and the container's (multipage's) width is 700px, a horizantal scroll will appear (and that is ok), the problem is that the new horizantal scroll bar, adds some pixels to the total height inside the container (that is if the scroll bar's height is 10 pixels, the total would be 510px), and at this moment the total height (510) is more that the container height (500), which causes a vertical scroll to appear.

I want only the horizantal scroll, the problem seems to be due of setting the heights of controls before taking into account the scrolling,

Please advice.
0
Comment
Question by:Inteqam
  • 7
  • 3
  • 3
  • +3
17 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 6940427
make the height 490 pix
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6940436
i don't make the height, it renders as the data is bound to the grid.
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6957876
maybe this code can help:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="GridColor.aspx.vb" Inherits="Tips.GridColor"%>
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.116, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
     <head>
          <title>GridColor</title>
          <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
          <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
          <meta name="vs_defaultClientScript" content="JavaScript">
          <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
     </head>
     <body ms_positioning="GridLayout">
          <form id="Form1" method="post" runat="server">
               <iewc:multipage id="MultiPage1" runat="server" height="100%" width="240px">
                    <iewc:pageview>
                         <asp:datagrid id="wsdgBagsList" tabindex="2" runat="server" autogeneratecolumns="False" width="100%" height="100%">
                              <selecteditemstyle cssclass="CSSDGSelectedItemStyle"></selecteditemstyle>
                              <edititemstyle cssclass="CSSDGEditItemStyle"></edititemstyle>
                              <alternatingitemstyle cssclass="CSSDGAlternatingStyle"></alternatingitemstyle>
                              <itemstyle cssclass="CSSDGItemStyle"></itemstyle>
                              <headerstyle cssclass="CSSDGHeaderStyle"></headerstyle>
                              <footerstyle cssclass="CSSDGFooterStyle"></footerstyle>
                              <columns>
                                   <asp:boundcolumn datafield="MNFT No." sortexpression="MNFT No." headertext="MNFT No."></asp:boundcolumn>
                                   <asp:boundcolumn datafield="Desc" sortexpression="Desc" headertext="Desc"></asp:boundcolumn>
                                   <asp:boundcolumn datafield="Bag ID" sortexpression="Bag ID" headertext="Bag ID"></asp:boundcolumn>
                              </columns>
                              <pagerstyle visible="False"></pagerstyle>
                         </asp:datagrid>
                    </iewc:pageview>
               </iewc:multipage>
          </form>
     </body>
</html>
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6957877
with code behind:


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim dt As DataTable
        Dim dr As DataRow
        Dim dv As DataView
        Dim i As Integer
        'create the datatable
        dt = New DataTable()
        dt.Columns.Add(New DataColumn("MNFT No.", GetType(String)))
        dt.Columns.Add(New DataColumn("Desc", GetType(String)))
        dt.Columns.Add(New DataColumn("Bag ID", GetType(String)))
        'dt.Columns.Add(New DataColumn("NoOfShpts", GetType(Integer)))
        'dt.Columns.Add(New DataColumn("Bages", GetType(String)))
        'dt.Columns.Add(New DataColumn("Shpts", GetType(String)))

        'Make some rows and put some sample data in
        For i = 1 To 5
            dr = dt.NewRow()

            dr(0) = "AMM-1111222333444" & (i + 1).ToString

            If (i Mod 2 = 0) Then
                dr(1) = "description  1333333 "
            Else
                dr(1) = "description  2222222"
            End If

            dr(2) = "012345678933222"

            dt.Rows.Add(dr)

        Next
        dv = New DataView(dt)
        dv.Sort = wsdgBagsList.Attributes("SortExpression")
        If (wsdgBagsList.Attributes("SortASC") = "no") Then
            dv.Sort += " DESC"
        End If
        wsdgBagsList.DataSource = dv
        wsdgBagsList.DataBind()

    End Sub
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6958256
Hello Inteqam,

I do not know how this controls behavior effectively in your case, but I would disable the scrollbars for the page and let only the datagrid have scrollbars.
Best place to try to disable unwanted scrollbars would be the page control.
Here a parameter description link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D6/S5B3DA.asp

Good luck,
zvonko

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6958332
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6959342
Thank you for your response

mplungjan, you answer led me to half the answer by using the style="OVERFLOW-Y: hidden" statement,
No the vertical scroll disappeared, but the problem is that the horizantal bar is taking space,

I mean that i want the Multipage to fit both the datagrid AND the scroll bar.

Please check the following changes in the code.

          <form id="Form1" method="post" runat="server">
               <iewc:multipage id="MultiPage1" style="OVERFLOW-Y: hidden; KEEPSCROLLBARSVISIBLE: 1" runat="server" width="240px" height="100%">
                    <iewc:pageview>
                         <table cellpadding="0" cellspacing="0">
                              <tr>
                                   <td>
                                        <asp:datagrid id="wsdgBagsList" tabindex="2" runat="server" autogeneratecolumns="False" width="100%" height="100%">
                                             <selecteditemstyle cssclass="CSSDGSelectedItemStyle"></selecteditemstyle>
                                             <edititemstyle cssclass="CSSDGEditItemStyle"></edititemstyle>
                                             <alternatingitemstyle cssclass="CSSDGAlternatingStyle"></alternatingitemstyle>
                                             <itemstyle cssclass="CSSDGItemStyle"></itemstyle>
                                             <headerstyle cssclass="CSSDGHeaderStyle"></headerstyle>
                                             <footerstyle cssclass="CSSDGFooterStyle"></footerstyle>
                                             <columns>
                                                  <asp:boundcolumn datafield="MNFT No." sortexpression="MNFT No." headertext="MNFT No."></asp:boundcolumn>
                                                  <asp:boundcolumn datafield="Desc" sortexpression="Desc" headertext="Desc"></asp:boundcolumn>
                                                  <asp:boundcolumn datafield="Bag ID" sortexpression="Bag ID" headertext="Bag ID"></asp:boundcolumn>
                                             </columns>
                                             <pagerstyle visible="False"></pagerstyle>
                                        </asp:datagrid>
                                   </td>
                              </tr>
                         </table>
                    </iewc:pageview>
               </iewc:multipage><input id="sss" style="Z-INDEX: 101; LEFT: 310px; POSITION: absolute; TOP: 345px" onclick="MyDiv.style.visibility='hidden';" type="button" value="Button">
               <div style="Z-INDEX: 102; LEFT: 62px; OVERFLOW: hidden; WIDTH: 120px; POSITION: absolute; TOP: 220px; HEIGHT: 100%"></div>
          </form>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6959474
Sorry - I have exhausted my ideas
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:zvonko
ID: 6959537
Did you not like to disable scrollbars?
<iewc:multipage id="MultiPage1" style="OVERFLOW-Y: hidden; KEEPSCROLLBARSVISIBLE: 0"

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6959576
Not exactly a well-known property ;-)

It is not in the dhtml reference at msdn at all...

I could only find it in the office 97 ref

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D6/S5B3DA.asp
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6959579
zvonko , i want the scrolls, but only the horizantal scroll, and i want it to work properly.
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6959585
mplungjan, this is the same link  zvonko  posted before.
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6959681
I do not see exact the philosophy of the controls, but I assume that after disabling the scrollbars from upper controls (multipage or pageview) you can still request to get the scrollbars for the datagrid control.
The result should be that vertical scrollbar disappear, right?

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6973951
Has this help you any?  zvonko was request a confirmation here from you on the vertical scrollbar.
Moondancer - EE Moderator
0
 
LVL 7

Author Comment

by:Inteqam
ID: 6974613
sorry for late respond zvonko

well, the answer for your question is yes,
i don't want the vertical scrollbar,

i want a horizantal scroll bar, and forcing one condition, the horizantal scroll bar should not take the place of a datagrid, it should take its own space.

i worked around this by adding a datagrid footer, and let the scrollbar take its place, but that works bad if the datagris does not need a scrollbar.
0
 

Expert Comment

by:modulo
ID: 7829913
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/Q_20485215.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 7853065
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now