Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

Datagrid with Multipage (.NET)

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
Inteqam
Asked:
Inteqam
  • 7
  • 3
  • 3
  • +3
1 Solution
 
Michel SakrCommented:
make the height 490 pix
0
 
InteqamAuthor Commented:
i don't make the height, it renders as the data is bound to the grid.
0
 
InteqamAuthor Commented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
InteqamAuthor Commented:
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
 
zvonkoCommented:
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
 
Michel PlungjanIT ExpertCommented:
0
 
InteqamAuthor Commented:
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
 
Michel PlungjanIT ExpertCommented:
Sorry - I have exhausted my ideas
0
 
zvonkoCommented:
Did you not like to disable scrollbars?
<iewc:multipage id="MultiPage1" style="OVERFLOW-Y: hidden; KEEPSCROLLBARSVISIBLE: 0"

0
 
Michel PlungjanIT ExpertCommented:
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
 
InteqamAuthor Commented:
zvonko , i want the scrolls, but only the horizantal scroll, and i want it to work properly.
0
 
InteqamAuthor Commented:
mplungjan, this is the same link  zvonko  posted before.
0
 
zvonkoCommented:
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
 
MoondancerCommented:
Has this help you any?  zvonko was request a confirmation here from you on the vertical scrollbar.
Moondancer - EE Moderator
0
 
InteqamAuthor Commented:
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
 
moduloCommented:
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
 
moduloCommented:
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 7
  • 3
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now