473,396 Members | 1,827 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,396 software developers and data experts.

Populating a datagrid dynamically, creating Session Variabbles

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 in a Class Module (VB), which populates the datagrid. The datagrid is bound in the code-behind the ASPX page, as such

dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet
dtg_worksheet1.DataBind(

The code to populate my datagrid from the class module (inpart) is
'Create the column headers
dt_worksheet1.Columns.Add(New DataColumn("County")
dt_worksheet1.Columns.Add(New DataColumn("Gasoline Gallons")
dt_worksheet1.Columns.Add(New DataColumn("Gasohol Gallons")
dt_worksheet1.Columns.Add(New DataColumn("Total Gallons")
'Build the DataTable with the Data

For i = 0 To li_rpd_array_row_len - 1 Step i +
Tr
' row number and withdrawal type
ls_temp = ao_buffer.ExtractString(CType(li_start_arr, Short), CType(li_arr_str_len, Short)
dr_gallons = dt_worksheet1.NewRow(
ls_temp_arr = ls_temp.Substring(li_county_name, li_county_name_len).Trim(
ls_county = ls_temp_arr.ToString().Tri
dr_gallons(0) = ls_count
ls_temp_arr = ls_temp.Substring(li_tot_gas_glln, li_tot_gas_glln_len).Trim(
ls_tot_gas = ls_temp_arr.ToString().Trim(
dr_gallons(1) = CInt(ls_tot_gas
ls_temp_arr = ls_temp.Substring(li_tot_gasohol_glln, li_tot_gasohol_glln_len).Trim(
ls_tot_gasohol = ls_temp_arr.ToString().Tri
dr_gallons(2) = CInt(ls_tot_gasohol
ls_tot_gallons = CDbl(ls_tot_gasohol) + CDbl(ls_tot_gas
dr_gallons(3) = CDbl(ls_tot_gallons

I need to know how to get a specific row/cell of data to post as a session variable - like I would with an ASP.Net table:

Dim ld_sum_tot_cty_tax As Doubl
Session("wa_tot_gal") = tbl_worksheet1.Rows(16).Cells(3).Text(

How can I do this programmatically with the datagrid? Any help is GREATLY appreciated! Coleen

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #1
7 5300
Cor
Hi Coleen,

The session variable in aspx acts the same as in classic asp pages.
I have not seen any differences till now. But another posibility is the
"viewstate", have a look for that on MSDN I think that is better for the
solution you are looking for.

Maybe for you intresting is that tomorrow is this chat that I wrote beneath

I hope this helps?

Cor
---------------------------------------------------------------------------
Do you have questions about how to create great ASP.NET applications with
Visual Basic .NET? Join members of the Visual Basic and Web Forms teams for
a discussion about getting the most out of your Web applications. Get
answers from the experts to your questions about Visual Basic and ASP.NET.

Date:
February 3, 2004

Time:
1:00 - 2:00 P.M. Pacific time
4:00 - 5:00 P.M. Eastern time
21:00 - 22:00 BST/BST
(For a list of local time zones relative to GMT, please see
http://msdn.microsoft.com/chats/timezones.asp.)

Outlook Reminder:
http://msdn.microsoft.com/chats/outl...s/VS_Feb03.vcs

Location:
http://msdn.microsoft.com/chats (then click the name of the chat to enter
the chat room)

For more information about Visual Basic .NET, see
http://msdn.microsoft.com/vbasic/
To see a list of upcoming chats or set a reminder for this chat, see
http://msdn.microsoft.com/chats.
For archives of previous chats, see
http://msdn.microsoft.com/chats/recent.asp.

Thanks!
Jason Cooke
VB.NET Team
========
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
(c) 2004 Microsoft Corporation. All rights reserved.
-------------------------------------------------

Nov 20 '05 #2
Honestly, I'm not looking for how to get the Session variable, I know how to do that, I'm trying to get a specific row/cell of data from the dynamically populated datagrid (to use as my session variable), and so far, not having much luck...thanks for your help :-)

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #3
Cor
Hi Coleen,

The problem is I do not see that tbl_workstheet1 when it is just a typo and
had to be dt_worksheet1 than I think it can be something as
Session("wa_tot_gal") = dt_worksheet1.Rows(16)(3).tostring
or complete
dt_workstheet1.Rows(16).item(3).tostring

I am curious if it was that?

Cor
Nov 20 '05 #4
No, I used the example of getting the specific row/column form an ASP table...I need to know how to get a specific row/column from a dynamically populated datagrid...

I have been trying everything I can think of to get the specific row(18).cell(7) from my datagrid. This works perfectly in an ASP table but NOT in a datagrid! I checked the Help files and can return a specific column, but I can't get to the specific ROW - I keep getting an error that the row is out of bounds. Or, I get an error (blue squigleys) that Row is not a part of Items or of Columns properties...ARGH! I just want a specific Row(18).Cell(7) from my datagrid - please how do I get this info from a datagrid? Thanks for your help :-) Coleen

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #5
Cor
Hi Colleen,

But why not just from your underlaying datatable, you have it.
(I did a while nothing with a aspx datagrid and that should I investigate).

Cor
Nov 20 '05 #6
I can't get the SPECIFIC row - it is imperitive that I get the value from specifically row 16, cell 7. This is simple in the ASPX table, but I can not get it from the datagrid. I can return a specific column, but Ican't seem to get it to give me the value for the exact row I need...any suggestions?

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #7
Cor
Hi Coleen,

Can you try this?

When clicked
Dim a As String = grd.Items(e.Item.ItemIndex).Cells(3).Text

or as you ask

Dim a as string = grd.Items(15).Cells(6).Text

I hope this helps?

Cor
<
I can't get the SPECIFIC row - it is imperitive that I get the value from specifically row 16, cell 7. This is simple in the ASPX table, but I can
not get it from the datagrid. I can return a specific column, but Ican't
seem to get it to give me the value for the exact row I need...any
suggestions?

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
1
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple...
2
by: ddaniel | last post by:
I have read many posts and seen many papers on the different techniques for sort and filtering datagrids. Many do re-queries against the dB ala Fritz Onion. I am trying to leverage the Dataview....
2
by: John Ninan | last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application I have a combobox(aspx Page). Which contains various items. Based on item selected I am dynamically populating...
2
by: charliewest | last post by:
I am dynamically creating my datagrid, building each column in real-time via code-behind (using c#). The only way i have read to add ImageButtons to my grid dynamically is by creating a separate...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
0
by: John Hopper | last post by:
Can someone please tell me why the datagrid doesn't databind and display rows once the Add button is clicked and the cmdSaveToDataset event fires, to add a row to the dataset? I've copied the code:...
9
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.