Welcome Guest Search | Active Topics | Sign In | Register

2 Grid Questions Options
Dave
Posted: Monday, June 30, 2008 8:10:53 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Hey Guys... I have 2 quesitons about Grid implementation.

1. How can I make the Grid both scroll and Page??? When I set allow paging to true, I am no longer able to scroll through the entire datatable. Here's the code that I'm using to load the Grid:

Code: C#
private void ReadTableLoadGrid()
        {

            using (SqlConnection myConnection = new SqlConnection(sConnectionString))
            {

                myConnection.Open();

                //mySelectQuery = BuildQueryString();
                SqlCommand myCmd1 = new SqlCommand(mySelectQuery, myConnection);

                SqlDataReader myReader;

                myReader = myCmd1.ExecuteReader();

                //itemGrid.RecordCount = 200;
                itemGrid.RecordCount = myReader.RecordsAffected;
                itemGrid.DataSource = myReader;
                itemGrid.DataBind();

                myReader.Close();
                myReader.Dispose();

                myConnection.Close();

                myConnection.Dispose();
                myCmd1.Dispose();

            }
        }


Pagesize is 15 records. I only have 100 or so records in the Grid and would like to be able to both scroll and page.

Also I'm only getting page numbers for paging, no <Previous> <Next> (etc.). Can something be done about this as well????

2. One of my grid columns is a Bit in my SQL Server database and I want to display it as "Yes" or "No" in the grid. It is returned in the datatable as a 1 or 0. How can I accomplish this???

Thanks for the help....

Dave
eo_support
Posted: Monday, June 30, 2008 10:15:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Dave,

When paging is enabled, scroll only scrolls within the current page. So if your PageSize is 15, then scroll would be only scrolling the 15 records. If the Grid's Height is greater than 15 records, then it won't display scroll bar at all.

You are not getting <Preview> and <Next> page because it's not needed in your case. In your case when all page numbers can be displayed, <Preview> and <Next> will not be displayed.

Currently there doesn't seem to be an easy way to display "Yes" or "No" in the Grid for a bit field except for changing the SQL select statement. For example, instead of using:

Code: SQL
select bit_field from ....


You can do:

Code: SQL
select iif(bit_field = 1, 'Yes', 'No") from ...


In the long run, we will look into it and see if we can do this automatically on our side.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.