PC Review


Reply
Thread Tools Rate Thread

Populating a datagrid dynamically, creating Session Variabbles

 
 
coleenholley
Guest
Posts: n/a
 
      2nd Feb 2004
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/
 
Reply With Quote
 
 
 
 
Cor
Guest
Posts: n/a
 
      3rd Feb 2004
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.
-------------------------------------------------



 
Reply With Quote
 
coleenholley
Guest
Posts: n/a
 
      3rd Feb 2004
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/
 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Feb 2004
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


 
Reply With Quote
 
coleenholley
Guest
Posts: n/a
 
      3rd Feb 2004
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/
 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Feb 2004
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


 
Reply With Quote
 
coleenholley
Guest
Posts: n/a
 
      3rd Feb 2004
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/
 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Feb 2004
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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically Populating a Gridview Isoaxis@gmail.com Microsoft ASP .NET 1 1st Mar 2006 01:56 AM
Dynamically populating menu MrJim Microsoft VB .NET 0 21st Feb 2006 03:21 PM
Populating Enum's dynamically =?Utf-8?B?U3VkaGFrYXJhLlQuUC4=?= Microsoft VB .NET 1 23rd Aug 2005 11:53 AM
Scrollable Datagrid : creating paging links dynamically outside the scroll bar RJN Microsoft ASP .NET 1 26th Oct 2004 05:25 PM
Dynamically populating Placeholder? Ben Arthur Microsoft ASP .NET 4 25th Mar 2004 07:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 PM.