473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Session Data and DataGrid

23
Hi people!
I need some help:
can I do something like this:
DataView CartView;
protected void BindGrid(int paging)
{
DataRow d;
DataTable Cart = new DataTable();
Cart.Columns.Add(new DataColumn("Text", typeof(String)));
Cart.Columns.Add(new DataColumn("Date_Input", typeof(String)));
Cart.Columns.Add(new DataColumn("page", typeof(int)));
int page = 1;
int count = 0;

clsDB objDb = new clsDB();
SqlDataReader dr = objDb.getRS("select top 800 * from Notice");
if (dr != null && dr.HasRows)
{
while (dr.Read())
{
if (count == 20)
{
count = 0;
page++;
}
d = Cart.NewRow();
d[0] = dr["Text"].ToString();
d[1] = dr["Date_Input"].ToString();
d[2] = page.ToString();
Cart.Rows.Add(d);
count++;
}
dr.Close();
}
Session["temp"] = Cart;
Cart.Clear();
Cart.Dispose();
if (objDb != null)
{
objDb.Close();
objDb = null;
}
ItemsGrid.VirtualItemCount = 800;
CartView = new DataView((DataTable)Session["Test"]);
CartView.Rowfilter = "page='"+paging.ToString()+"'";
ItemsGrid.DataSource = CartView;
ItemsGrid.DataBind();
}

I mean can I get Data from Session like this method i used?
DataTable has data coz clsDB works nice.
May 7 '07 #1
1 1135
filmar
23
I just don`t want to allocate addition memory for new DataTable
May 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? ...
8
by: MattB | last post by:
Hello I am starting a new thread in a button click event. This thread calls an method which sends emails, I don't want the page to wait for the emails to finish going out as it slows the user...
0
by: Paul | last post by:
Hello, all --- Environment: Visual Studio.NET 2003 (C#); Windows 2003 Server; IIS 6.0 Here is the problem I am having. I have created a web custom control in C# which includes a datagrid,...
2
by: Paul | last post by:
Tried to post this hours ago, but it still isn't visible. If it's a repeat, sorry for the inconvenience. Hello, all --- Environment: Visual Studio.NET 2003 (C#); Windows 2003 Server; IIS 6.0...
14
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows...
4
by: Ralph Krausse | last post by:
ViewState = "Bill"; -- This statement will send that to the browser and hash it into the __VIEWSTATE hidden varible Application = "Bill"; -- This statement will keep this info on the server ...
3
by: Jesper Pedersen | last post by:
This works fine: <% Session=1; %> but this: <% Session=%> <%# DataBinder.Eval(Container.DataItem, "playerID") %> <%; %> do not work. The playerID contains the value 1, so the values in both...
4
by: Gaetan | last post by:
I have an ASP.Net 1.1 application using datagrid. I am trying to handle conditions where the users post back an updated datagrid after the session times out. The results are not pretty. Sometimes...
7
by: coleenholley | last post by:
Hi all :-) I have a couple of web pages created using ASP.Net and VB code-behind. We use a connection call through an RPC to COBOL, NOT an SQL connection, so my connection to get the data is done...
3
by: rn5a | last post by:
A ASPX Form has a TextBox & a Button. Users enter their username in the TextBox & submit the Form after which records pertaining to the username get retrieved from a MS-Access database table &...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.