472,962 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 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 5280
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.