This is a migrated thread and some comments may be shown as answers.

radgrid scroll problem

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dima
Top achievements
Rank 1
dima asked on 30 Sep 2009, 01:55 PM
Hello,
I'm trying create grid without pager with vertical scroll.

Please see code below:
 
<radG:RadGrid runat="server" ID="gvMultiUpload" 
              AutoGenerateColumns="false"   
              AllowMultiRowSelection="true" 
              Height="105px" 
              Width="364px">   
                        <MasterTableView Width="100%" TableLayout="Fixed">  
                            <Columns> 
                               <radG:GridClientSelectColumn AutoPostBackOnFilter="false" HeaderStyle-Width="23px" /> 
                                <radG:GridBoundColumn UniqueName="PalletSerialNumber" DataField="PalletSerialNumber" HeaderText="<%$ Resources:GridResource, PalletNum %>" />     
                                <radG:GridBoundColumn UniqueName="TagSerialNumber" DataField="TagSerialNumber" HeaderText="<%$ Resources:GridResource, SensorID %>" />                                 
                                <radG:GridTemplateColumn UniqueName="PalletLocation" HeaderText="<%$ Resources:Resource, lblPalletLocation %>">  
                                     <itemstyle horizontalalign="Center" /> 
                                     <headerstyle horizontalalign="Center" /> 
                                     <itemtemplate> 
                                        <radI:RadNumericTextBox ID="txtPalletLocation" runat="server" Type="Number"  Width="30px"   
                                            MinValue="1" MaxValue="26" 
                                            CssClass="smallTextBox" 
                                            ShowSpinButtons="true">    
                                            <NumberFormat DecimalDigits="0" />    
                                        </radI:RadNumericTextBox>    
                                     </itemtemplate> 
                                </radG:GridTemplateColumn> 
                            </Columns> 
                        </MasterTableView> 
                        <ClientSettings> 
                            <Selecting AllowRowSelect="true" /> 
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" /> 
                        </ClientSettings> 
                    </radG:RadGrid>      

Attachment is a result of this code!!!

Any ideas?

Thanks a lot

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 30 Sep 2009, 02:23 PM
Hello Dima,

The provided RadGrid declaration works as expected on my side (see below). It seems to me that the RadGrid height is changed at runtime on the server or the client?

Please send us a complete page, similar to this one, which exhibits the unexpected behavior:

<%@ Page Language="C#" %> 
<%@ Import Namespace="System.Data" %> 
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %> 
<%@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="radI" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
 
    protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) 
    { 
        DataTable dt = new DataTable(); 
        DataRow dr; 
        int rowsNum = 10
        string[][] colsInfo = { 
        new string[] { "PalletSerialNumber", "number" }, 
        new string[] { "TagSerialNumber", "number" } 
    }; 
 
        for (int i = 0; i < colsInfo.Length; i++) 
        { 
            switch (colsInfo[i][1]) 
            { 
                case "string": 
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(String))); 
                    break; 
                case "number": 
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(Int32))); 
                    break; 
                case "date": 
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(DateTime))); 
                    break; 
                case "bool": 
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(Boolean))); 
                    break; 
                default: 
                    break; 
            } 
        } 
 
        for (int j = 1; j <= rowsNum; j++) 
        { 
            dr = dt.NewRow(); 
 
            for (int k = 0; k < colsInfo.Length; k++) 
            { 
                switch (colsInfo[k][1]) 
                { 
                    case "string": 
                        dr[colsInfo[k][0]] = String.Format("{0} Row{1}", colsInfo[k][0], j); 
                        break; 
                    case "number": 
                        dr[colsInfo[k][0]] = j; 
                        break; 
                    case "date": 
                        dr[colsInfo[k][0]] = DateTime.Now; 
                        break; 
                    case "bool": 
                        dr[colsInfo[k][0]] = j % 2 == 1 ? true : false; 
                        break; 
                    default: 
                        break; 
                } 
            } 
            dt.Rows.Add(dr); 
        } 
 
        (sender as RadGrid).DataSource = dt
    } 
     
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
<radG:RadGrid runat="server" ID="gvMultiUpload"  
              AutoGenerateColumns="false" 
              OnNeedDataSource="RadGrid_NeedDataSource" 
              AllowMultiRowSelection="true"  
              Height="105px"  
              Width="364px">    
                        <MasterTableView Width="100%" TableLayout="Fixed">   
                            <Columns>  
                               <radG:GridClientSelectColumn AutoPostBackOnFilter="false" HeaderStyle-Width="23px" />  
                                <radG:GridBoundColumn UniqueName="PalletSerialNumber" DataField="PalletSerialNumber" HeaderText="Pallet ID" />      
                                <radG:GridBoundColumn UniqueName="TagSerialNumber" DataField="TagSerialNumber" HeaderText="Sensor ID" />                                  
                                <radG:GridTemplateColumn UniqueName="PalletLocation" HeaderText="Pallet Location">   
                                     <itemstyle horizontalalign="Center" />  
                                     <headerstyle horizontalalign="Center" />  
                                     <itemtemplate>  
                                        <radI:RadNumericTextBox ID="txtPalletLocation" runat="server" Type="Number"  Width="30px"    
                                            MinValue="1" MaxValue="26"  
                                            CssClass="smallTextBox"  
                                            ShowSpinButtons="true">     
                                            <NumberFormat DecimalDigits="0" />     
                                        </radI:RadNumericTextBox>     
                                     </itemtemplate>  
                                </radG:GridTemplateColumn>  
                            </Columns>  
                        </MasterTableView>  
                        <ClientSettings>  
                            <Selecting AllowRowSelect="true" />  
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />  
                        </ClientSettings>  
                    </radG:RadGrid>  
 
</form> 
</body> 
</html> 



Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
dima
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or